mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
tests: create new request instead of updating old
This commit is contained in:
parent
da6515dddd
commit
5627e80b27
1 changed files with 7 additions and 2 deletions
|
@ -183,12 +183,17 @@ func handleRedirect(w *httptest.ResponseRecorder, req *http.Request) (int, *byte
|
||||||
w.Code == http.StatusPermanentRedirect {
|
w.Code == http.StatusPermanentRedirect {
|
||||||
|
|
||||||
// Follow external redirect
|
// Follow external redirect
|
||||||
var err error
|
redirURL, err := w.Result().Location()
|
||||||
req.URL, err = w.Result().Location()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, nil, fmt.Errorf("Invalid location header")
|
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{}
|
client := &http.Client{}
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue