The redirect status code decides whether the follow-up repeats your POST or switches to a GET. Today you pin that rule - the one place the 3xx codes genuinely differ.
Decide the follow-up method and whether to keep the body from the redirect status and original method.
This is the one place the redirect codes genuinely diverge, and it is worth pinning
exactly. 303 See Other always switches the follow-up to GET and drops the body
So for a POST, a 303 or 302 sends a bodyless GET to the new location, while a 307 or 308 re-sends the whole POST. Getting this right is what keeps a redirect from either losing data or re-submitting a form unexpectedly. It is a small function, but it encodes a genuine and often-misunderstood rule of HTTP.
// 303 -> always GET, drop the body// 307, 308 -> preserve the method AND the body// 301, 302 -> a POST becomes GET (drop body); GET/HEAD unchangedfunc redirectMethod(status int, method string) (newMethod string, keepBody bool) {// switch on status; return the method + whether to resend the body}