Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLASweb-backend-go
Commits
5627e80b
Commit
5627e80b
authored
Jan 18, 2021
by
Steffen Vogel
🎅🏼
Browse files
tests: create new request instead of updating old
parent
da6515dd
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
helper/test_utilities.go
View file @
5627e80b
...
...
@@ -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
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment