Browse Source

Update documentation for URLParams rename

Carl Jackson 12 years ago
parent
commit
ced741fddf
4 changed files with 6 additions and 6 deletions
  1. +1
    -1
      README.md
  2. +1
    -1
      goji.go
  3. +1
    -1
      web/router.go
  4. +3
    -3
      web/web.go

+ 1
- 1
README.md View File

@ -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() {


+ 1
- 1
goji.go View File

@ -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() {


+ 1
- 1
web/router.go View File

@ -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
}


+ 3
- 3
web/web.go View File

@ -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
@ -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 {


Loading…
Cancel
Save