Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify how route variables work. (#151) #199

Merged
merged 2 commits into from
Jan 17, 2017

Conversation

wirehead
Copy link

(this confused the heck out of me while trying to use Gorilla)

  • Changed request to be just r, like the other handlers.
  • Created complete wrapper function instead of just 2 lines.

(this confused the heck out of me while trying to use Gorilla)

* Changed `request` to be just `r`, like the other handlers.
* Created complete wrapper function instead of just 2 lines.
category := vars["category"]
func ArticlesCategoryHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why set this to "application/json", or anything at all? It doesn't really contribute anything to the example.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll fix that. :)

Review comment: setting the header complicates things.
@kisielk kisielk merged commit b128961 into gorilla:master Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants