diff options
Diffstat (limited to 'src/bun.js/api')
-rw-r--r-- | src/bun.js/api/html_rewriter.zig | 28 | ||||
-rw-r--r-- | src/bun.js/api/server.zig | 6 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/bun.js/api/html_rewriter.zig b/src/bun.js/api/html_rewriter.zig index 1bda47512..1f2366ad9 100644 --- a/src/bun.js/api/html_rewriter.zig +++ b/src/bun.js/api/html_rewriter.zig @@ -384,10 +384,10 @@ pub const HTMLRewriter = struct { result.* = Response{ .allocator = bun.default_allocator, + .init = .{ + .status_code = 200, + }, .body = .{ - .init = .{ - .status_code = 200, - }, .value = .{ .Locked = .{ .global = global, @@ -397,16 +397,16 @@ pub const HTMLRewriter = struct { }, }; - result.body.init.method = original.body.init.method; - result.body.init.status_code = original.body.init.status_code; + result.init.method = original.init.method; + result.init.status_code = original.init.status_code; + result.init.status_text = original.init.status_text.clone(); // https://github.com/oven-sh/bun/issues/3334 - if (original.body.init.headers) |headers| { - result.body.init.headers = headers.cloneThis(global); + if (original.init.headers) |headers| { + result.init.headers = headers.cloneThis(global); } result.url = original.url.clone(); - result.status_text = original.status_text.clone(); var value = original.getBodyValue(); sink.bodyValueBufferer = JSC.WebCore.BodyValueBufferer.init(sink, onFinishedBuffering, sink.global, bun.default_allocator); sink.bodyValueBufferer.?.run(value) catch |buffering_error| { @@ -606,10 +606,10 @@ pub const HTMLRewriter = struct { // result.* = Response{ // .allocator = bun.default_allocator, + // .init = .{ + // .status_code = 200, + // }, // .body = .{ - // .init = .{ - // .status_code = 200, - // }, // .value = .{ // .Locked = .{ // .global = global, @@ -619,9 +619,9 @@ pub const HTMLRewriter = struct { // }, // }; - // result.body.init.headers = original.body.init.headers; - // result.body.init.method = original.body.init.method; - // result.body.init.status_code = original.body.init.status_code; + // result.init.headers = original.init.headers; + // result.init.method = original.init.method; + // result.init.status_code = original.init.status_code; // result.url = bun.default_allocator.dupe(u8, original.url) catch unreachable; // result.status_text = bun.default_allocator.dupe(u8, original.status_text) catch unreachable; diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index d90c22577..1df908a0b 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -2988,7 +2988,7 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp var needs_content_type = true; const content_type: MimeType = brk: { - if (response.body.init.headers) |headers_| { + if (response.init.headers) |headers_| { if (headers_.fastGet(.ContentType)) |content| { needs_content_type = false; break :brk MimeType.byName(content.slice()); @@ -3008,7 +3008,7 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp }; var has_content_disposition = false; - if (response.body.init.headers) |headers_| { + if (response.init.headers) |headers_| { has_content_disposition = headers_.fastHas(.ContentDisposition); needs_content_range = needs_content_range and headers_.fastHas(.ContentRange); if (needs_content_range) { @@ -3018,7 +3018,7 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp this.writeStatus(status); this.writeHeaders(headers_); - response.body.init.headers = null; + response.init.headers = null; headers_.deref(); } else if (needs_content_range) { status = 206; |