This commit is contained in:
Ciro Spaciari
2025-11-10 17:09:46 -08:00
parent b8c281a313
commit f478f84d62
3 changed files with 8 additions and 6 deletions

View File

@@ -1371,7 +1371,7 @@ pub fn Bun__fetch_(
body.detach();
} else {
// These are single-use, and have effectively been moved to the FetchTasklet.
body = HTTPRequestBody.Empty;
body = FetchTasklet.HTTPRequestBody.Empty;
}
proxy = null;
url_proxy_buffer = "";

View File

@@ -463,11 +463,11 @@ export fn Bun__FetchResponse_finalize(this: *FetchTasklet) callconv(.c) void {
if (body.Locked.promise) |promise| {
if (promise.isEmptyOrUndefinedOrNull()) {
// Scenario 2b.
this.ignoreRemainingResponseBody();
this.response.ignoreRemainingResponseBody();
}
} else {
// Scenario 3.
this.ignoreRemainingResponseBody();
this.response.ignoreRemainingResponseBody();
}
}
}

View File

@@ -14,7 +14,7 @@ readable_stream_ref: jsc.WebCore.ReadableStream.Strong = .{},
/// response weak ref we need this to track the response JS lifetime
response: jsc.Weak(FetchTasklet) = .{},
/// native response ref if we still need it when JS is discarted
native_response: ?*Response = null,
native_response: ?*jsc.WebCore.Response = null,
/// For Http Client requests
/// when Content-Length is provided this represents the whole size of the request
@@ -22,7 +22,9 @@ native_response: ?*Response = null,
/// If is not chunked encoded and Content-Length is not provided this will be unknown
body_size: http.HTTPClientResult.BodySize = .unknown,
state: enum {
state: ResponseState = .created,
const ResponseState = enum {
created,
enqueued,
// information_headers,
@@ -31,7 +33,7 @@ state: enum {
// receiving_trailer_headers,
failed,
done,
} = .created,
};
pub const Flags = packed struct(u8) {
ignore_data: bool = false,