diff options
author | 2023-05-11 18:25:21 -0300 | |
---|---|---|
committer | 2023-05-11 14:25:21 -0700 | |
commit | 3530cfac68a616c88e4a7b19f5da29f79883c971 (patch) | |
tree | 6aebb31540e83531ea59fb2278fa9a24820cd330 /src/http_client_async.zig | |
parent | bc7d0adcf94d65b9238c6cb0aceb38c86cc323b3 (diff) | |
download | bun-3530cfac68a616c88e4a7b19f5da29f79883c971.tar.gz bun-3530cfac68a616c88e4a7b19f5da29f79883c971.tar.zst bun-3530cfac68a616c88e4a7b19f5da29f79883c971.zip |
fix redirect: \'manual\' and setTimeout on node:http request (#2848)
Diffstat (limited to 'src/http_client_async.zig')
-rw-r--r-- | src/http_client_async.zig | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/http_client_async.zig b/src/http_client_async.zig index 3f8b6998f..87d59778e 100644 --- a/src/http_client_async.zig +++ b/src/http_client_async.zig @@ -2835,14 +2835,13 @@ pub fn handleResponseMetadata( else => {}, } } else if (this.redirect_type == FetchRedirect.@"error") { + // error out if redirect is not allowed return error.UnexpectedRedirect; - } else if (this.redirect_type == FetchRedirect.manual) { - this.state.response_stage = if (this.state.transfer_encoding == .chunked) .body_chunk else .body; - return false; } } + // if is no redirect or if is redirect == "manual" just proceed this.state.response_stage = if (this.state.transfer_encoding == .chunked) .body_chunk else .body; - + // if no body is expected we should stop processing return this.method.hasBody() and (this.state.body_size > 0 or this.state.transfer_encoding == .chunked); } |