Hello,
I have a session cookie provided with the POST response, however, it is a HTTP 302 (redirect). I am trying to find-between, however, I cannot extract the session value to further propagate it in requests. When I --http-debug=“full”, however, I see the data of interest. How do I extract response header value from HTTP redirects?
Regards,
Gavin
Hi @gavindelatour ,
You can add {redirect: 0} param to the http request.
Here is an example, I hope it helps:
import http from 'k6/http';
var url = "http://test.k6.io" // redirected to https
export default function () {
var res;
res = http.get(url);
console.log(res.status_text); // prints "200 OK"
res = http.get(url, {redirects:0});
console.log(res.status_text); // prints "308 Permanent Redirect"
}
@bandorko,
Thank you, that worked like a charm!
Regards,
Gavin
1 Like