On Fri, Oct 27, 2017 at 09:04:25PM -0700, hkang.sun...@gmail.com wrote: > I have a question about sending POST request through the http.Redirect > function. > The following is my http handler function. In this function, I get some > secret data and want to pass the data to the redirectURL. > I could not use GET with query parameter because the secret data is > explicit as a query in a GET redirect URL. So I am thinking sending the > data in the body of a POST request. > > func myHandler (w http.ResponseWriter, r *HTTPRequest) { > // process and get some secret data > data := someValue > http.Redirect(w, r, redirectURL, http.StatusFound) > } > > I tried setting "r.Method="POST""; however it does not work. > Could anyone help on this? Thanks. in advance.
Try if using http.StatusTemporaryRedirect instead of http.StatusFound works better: StatusTemporaryRedirect = 307 // RFC 7231, 6.4.7 -- Valentin -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.