|
|
|
@ -99,7 +99,7 @@ func NewGreet(w http.ResponseWriter, r *http.Request) { |
|
|
|
// GetUser finds a given user and her greets (GET "/user/:name")
|
|
|
|
func GetUser(c web.C, w http.ResponseWriter, r *http.Request) { |
|
|
|
io.WriteString(w, "Gritter\n======\n\n") |
|
|
|
handle := c.UrlParams["name"] |
|
|
|
handle := c.URLParams["name"] |
|
|
|
user, ok := Users[handle] |
|
|
|
if !ok { |
|
|
|
http.Error(w, http.StatusText(404), 404) |
|
|
|
@ -119,7 +119,7 @@ func GetUser(c web.C, w http.ResponseWriter, r *http.Request) { |
|
|
|
// GetGreet finds a particular greet by ID (GET "/greet/\d+"). Does no bounds
|
|
|
|
// checking, so will probably panic.
|
|
|
|
func GetGreet(c web.C, w http.ResponseWriter, r *http.Request) { |
|
|
|
id, err := strconv.Atoi(c.UrlParams["id"]) |
|
|
|
id, err := strconv.Atoi(c.URLParams["id"]) |
|
|
|
if err != nil { |
|
|
|
http.Error(w, http.StatusText(404), 404) |
|
|
|
return |
|
|
|
|