From 0cff1463b1ed6f50b4f0d19af17b2d5dbfd0b676 Mon Sep 17 00:00:00 2001 From: HiteshShonak Date: Sat, 21 Mar 2026 18:04:13 +0530 Subject: [PATCH] fix(fetch): set correct type for Response.redirect() --- core/runtime/src/fetch/response.rs | 2 +- core/runtime/src/fetch/tests/response.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/runtime/src/fetch/response.rs b/core/runtime/src/fetch/response.rs index 442ed64d5eb..09ce5ee7793 100644 --- a/core/runtime/src/fetch/response.rs +++ b/core/runtime/src/fetch/response.rs @@ -319,7 +319,7 @@ impl JsResponse { Ok(Self { url: js_string!(""), - r#type: ResponseType::Basic, + r#type: ResponseType::Default, status: status_code.as_u16(), status_text: JsString::from(status_code.canonical_reason().unwrap_or("")), headers: JsHeaders::from_http(headers), diff --git a/core/runtime/src/fetch/tests/response.rs b/core/runtime/src/fetch/tests/response.rs index ee8108751d8..fecc0c62fd9 100644 --- a/core/runtime/src/fetch/tests/response.rs +++ b/core/runtime/src/fetch/tests/response.rs @@ -171,6 +171,20 @@ fn response_redirect_default_status() { ]); } +#[test] +fn response_redirect_type_default() { + run_test_actions([ + TestAction::harness(), + TestAction::inspect_context(|ctx| register(&[], ctx)), + TestAction::run( + r#" + assertEq(Response.redirect("http://unit.test").type, "default"); + assertEq(Response.redirect("http://unit.test", 301).type, "default"); + "#, + ), + ]); +} + #[test] fn response_redirect_custom_status_and_coercion() { run_test_actions([