mirror of
https://github.com/wahyd4/golink.git
synced 2026-08-09 05:05:56 +10:00
golink: set HTTP status after Location header
I didn't think the order mattered (as long as none of the response body had been written), but I guess I was wrong. Currently, it's returning the 302 status, but no Location header. And tests, at least some of which should be passing through this full code path, are passing. I'll look into adding better testing later, but for now this fixes the immediate issue. Updates #91 Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
@@ -425,8 +425,8 @@ func serveGo(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// http.Redirect always cleans the redirect URL, which we don't always want.
|
||||
// Instead, manually set status and Location header.
|
||||
w.WriteHeader(http.StatusFound)
|
||||
w.Header().Set("Location", target.String())
|
||||
w.WriteHeader(http.StatusFound)
|
||||
}
|
||||
|
||||
// acceptHTML returns whether the request can accept a text/html response.
|
||||
|
||||
Reference in New Issue
Block a user