Skip to content

Commit

Permalink
Update documentation for URLParams rename
Browse files Browse the repository at this point in the history
  • Loading branch information
zenazn committed Apr 12, 2014
1 parent 0e34b28 commit ced741f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

func hello(c web.C, w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %s!", c.UrlParams["name"])
fmt.Fprintf(w, "Hello, %s!", c.URLParams["name"])
}

func main() {
Expand Down
2 changes: 1 addition & 1 deletion goji.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Example:
)
func hello(c web.C, w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %s!", c.UrlParams["name"])
fmt.Fprintf(w, "Hello, %s!", c.URLParams["name"])
}
func main() {
Expand Down
2 changes: 1 addition & 1 deletion web/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type Pattern interface {
// Returns true if the request satisfies the pattern. This function is
// free to examine both the request and the context to make this
// decision. After it is certain that the request matches, this function
// should mutate or create c.UrlParams if necessary, unless dryrun is
// should mutate or create c.URLParams if necessary, unless dryrun is
// set.
Match(r *http.Request, c *C, dryrun bool) bool
}
Expand Down
6 changes: 3 additions & 3 deletions web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ Use your favorite HTTP verbs:
Bind parameters using either Sinatra-like patterns or regular expressions:
m.Get("/hello/:name", func(c web.C, w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %s!", c.UrlParams["name"])
fmt.Fprintf(w, "Hello, %s!", c.URLParams["name"])
})
pattern := regexp.MustCompile(`^/ip/(?P<ip>(?:\d{1,3}\.){3}\d{1,3})$`)
m.Get(pattern, func(c web.C, w http.ResponseWriter, r *http.Request) {
fmt.Printf(w, "Info for IP address %s:", c.UrlParams["ip"])
fmt.Printf(w, "Info for IP address %s:", c.URLParams["ip"])
})
Middleware are functions that wrap http.Handlers, just like you'd use with raw
Expand Down Expand Up @@ -84,7 +84,7 @@ layers and to the final request handler.
As an implementation detail, references to these structs are reused between
requests to reduce allocation churn, but the maps they contain are created fresh
on every request. If you are closing over a context (especially relevant for
middleware), you should not close over either the UrlParams or Env objects,
middleware), you should not close over either the URLParams or Env objects,
instead accessing them through the context whenever they are required.
*/
type C struct {
Expand Down

0 comments on commit ced741f

Please sign in to comment.