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.
Is this expected behaviour?