Browse Source

Return Location headers on 302s

WriteHeader must come AFTER Header().Set() else it does nothing, yay!
pull/36/head
Kegan Dougal 8 years ago
parent
commit
25fb7ca0d9
  1. 2
      src/github.com/matrix-org/go-neb/realms/github/github.go

2
src/github.com/matrix-org/go-neb/realms/github/github.go

@ -230,8 +230,8 @@ func (r *GithubRealm) OnReceiveRedirect(w http.ResponseWriter, req *http.Request
func (r *GithubRealm) redirectOr(w http.ResponseWriter, code int, msg string, logger *log.Entry, ghSession *GithubSession) {
if ghSession.ClientsRedirectURL != "" {
w.WriteHeader(302)
w.Header().Set("Location", ghSession.ClientsRedirectURL)
w.WriteHeader(302)
// technically don't need a body but *shrug*
w.Write([]byte(ghSession.ClientsRedirectURL))
} else {

Loading…
Cancel
Save