I am trying to return a response via the HTTPResponseBuilder but even when I am using a custom status_code say 307 and a header of Location: google.com, my browser is not redirecting me to the same website.
Here is the sample code that I using:
let mut response = HttpResponse::Ok();
let status_code =
actix_http::StatusCode::from_str(contents.get("status_code").unwrap()).unwrap();
apply_headers(&mut response, headers[0].clone());
response.status(status_code);
println!(
"The status code is {} and the headers are {:?}",
status_code, headers
);
response.body(contents.get("body").unwrap().to_owned())
I can share the entire PR but this is the relevant part IMO.