if a redirect with a body is provided, we need to skip the body #2

Merged
hannes merged 2 commits from fixes into main 2024-11-05 11:28:40 +00:00
Showing only changes of commit bd6c9edff6 - Show all commits

View file

@ -434,6 +434,12 @@ let request
let rec follow_redirect count uri = let rec follow_redirect count uri =
if count = 0 then Lwt.return_error (`Msg "Redirect limit exceeded") if count = 0 then Lwt.return_error (`Msg "Redirect limit exceeded")
else else
let f response acc body =
if Status.is_redirection response.status then
Lwt.return acc
else
f response acc body
in
single_request ~ctx ~alpn_protocol ?config tls_config ~meth ~headers single_request ~ctx ~alpn_protocol ?config tls_config ~meth ~headers
?body uri f f_init ?body uri f f_init
>>? fun (resp, body) -> >>? fun (resp, body) ->