Skip to content

Commit 7f89e2e

Browse files
committed
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 <[email protected]>
1 parent 7db43e2 commit 7f89e2e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

golink.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ func serveGo(w http.ResponseWriter, r *http.Request) {
425425

426426
// http.Redirect always cleans the redirect URL, which we don't always want.
427427
// Instead, manually set status and Location header.
428-
w.WriteHeader(http.StatusFound)
429428
w.Header().Set("Location", target.String())
429+
w.WriteHeader(http.StatusFound)
430430
}
431431

432432
// acceptHTML returns whether the request can accept a text/html response.

0 commit comments

Comments
 (0)