During a recent performance test I ran into an issue with redirects: I was getting status code 400’s for a request that was getting redirected once.
To solve the issue, I set maxRedirects to 0 in options, and caught the redirect response manually. Inspecting response.headers.Location, I noticed that the string was not encoded properly (spaces instead of ‘%20’). Sending a subsequent get request to encodeURI(response.headers.Location), I was able to perform the redirect correctly.
As part of a QA team, indeed I do not rule out a problem with the server.
I’ve verified with curl that the server returns an improperly encoded location in the response headers. Browsers and Postman seem to preemptively fix the encoding issue, whereas k6 and curl do not.
Thank you for your response, I think this answers the issue!