Commit 5627e80b authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

tests: create new request instead of updating old

parent da6515dd
......@@ -183,12 +183,17 @@ func handleRedirect(w *httptest.ResponseRecorder, req *http.Request) (int, *byte
w.Code == http.StatusPermanentRedirect {
// Follow external redirect
var err error
req.URL, err = w.Result().Location()
redirURL, err := w.Result().Location()
if err != nil {
return 0, nil, fmt.Errorf("Invalid location header")
}
// TODO: resend orginal request body
req, err := http.NewRequest(req.Method, redirURL.String(), nil)
if err != nil {
return 0, nil, fmt.Errorf("Failed to create new request: %v", err)
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment