Skip to content

Commit

Permalink
Don't set Content-Type for httperror.Redirect.
Browse files Browse the repository at this point in the history
Remove workaround for https://groups.google.com/forum/#!topic/golang-nuts/9AVyMP9C8Ac
since it has been fixed upstream in Go 1.10.
  • Loading branch information
dmitshur committed Mar 19, 2018
1 parent 4920403 commit fb55a2f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 12 deletions.
3 changes: 0 additions & 3 deletions code.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ func (h *codeHandler) ServeCodeMaybe(w http.ResponseWriter, req *http.Request) (
if d.Package == nil {
u := *req.URL
u.Path += "/..."
if req.Method == http.MethodGet { // Workaround for https://groups.google.com/forum/#!topic/golang-nuts/9AVyMP9C8Ac.
w.Header().Set("Content-Type", "text/html; charset=utf-8")
}
http.Redirect(w, req, u.String(), http.StatusSeeOther)
return true
}
Expand Down
3 changes: 0 additions & 3 deletions httputil/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ func (h *errorHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
if err, ok := httperror.IsRedirect(err); ok {
if req.Method == http.MethodGet { // Workaround for https://groups.google.com/forum/#!topic/golang-nuts/9AVyMP9C8Ac.
w.Header().Set("Content-Type", "text/html; charset=utf-8")
}
http.Redirect(w, req, err.URL, http.StatusSeeOther)
return
}
Expand Down
6 changes: 0 additions & 6 deletions sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,6 @@ func (h *sessionsHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
if err, ok := httperror.IsRedirect(err); ok {
if req.Method == http.MethodGet { // Workaround for https://groups.google.com/forum/#!topic/golang-nuts/9AVyMP9C8Ac.
w.Header().Set("Content-Type", "text/html; charset=utf-8")
}
http.Redirect(w, req, err.URL, http.StatusSeeOther)
return
}
Expand Down Expand Up @@ -360,9 +357,6 @@ func (h *sessionsHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
Path: "/login",
RawQuery: url.Values{returnQueryName: {req.RequestURI}}.Encode(),
}).String()
if req.Method == http.MethodGet { // Workaround for https://groups.google.com/forum/#!topic/golang-nuts/9AVyMP9C8Ac.
w.Header().Set("Content-Type", "text/html; charset=utf-8")
}
http.Redirect(w, req, loginURL, http.StatusSeeOther)
return
}
Expand Down

0 comments on commit fb55a2f

Please sign in to comment.