mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Fix Location header not being cloned from Response.redirect() (#7402)
* Fix `Location` header not being cloned from `Response.redirect()` * Fix was something else
This commit is contained in:
@@ -1457,7 +1457,7 @@ void WebCore__FetchHeaders__put_(WebCore__FetchHeaders* headers, const ZigString
|
||||
{
|
||||
auto throwScope = DECLARE_THROW_SCOPE(global->vm());
|
||||
WebCore::propagateException(*global, throwScope,
|
||||
headers->set(Zig::toString(*arg1), Zig::toString(*arg2)));
|
||||
headers->set(Zig::toString(*arg1), Zig::toStringCopy(*arg2)));
|
||||
}
|
||||
void WebCore__FetchHeaders__remove(WebCore__FetchHeaders* headers, const ZigString* arg1, JSC__JSGlobalObject* global)
|
||||
{
|
||||
|
||||
10
test/regression/issue/07397.test.ts
Normal file
10
test/regression/issue/07397.test.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { test, expect } from "bun:test";
|
||||
|
||||
test("Response.redirect clones string from Location header", () => {
|
||||
const url = new URL("http://example.com");
|
||||
url.hostname = "example1.com";
|
||||
const { href } = url;
|
||||
expect(href).toBe("http://example1.com/");
|
||||
const response = Response.redirect(href);
|
||||
expect(response.headers.get("Location")).toBe(href);
|
||||
});
|
||||
Reference in New Issue
Block a user