mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 03:18:53 +00:00
## Summary
- `new Request()` was ignoring `cache` and `mode` options, always
returning hardcoded default values ("default" for cache, "navigate" for
mode)
- Added proper storage and handling of these options in the Request
struct
- Both options are now correctly parsed from the constructor init object
and preserved when cloning
Fixes #2993
## Test plan
- [x] Added regression test in `test/regression/issue/2993.test.ts`
- [x] Tests verify all valid cache values: "default", "no-store",
"reload", "no-cache", "force-cache", "only-if-cached"
- [x] Tests verify all valid mode values: "same-origin", "no-cors",
"cors", "navigate"
- [x] Tests verify default values (cache: "default", mode: "cors")
- [x] Tests verify `Request.clone()` preserves options
- [x] Tests verify `new Request(request)` preserves options
- [x] Tests verify `new Request(request, init)` allows overriding
options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
14 lines
273 B
Zig
14 lines
273 B
Zig
pub const FetchRedirect = enum(u2) {
|
|
follow,
|
|
manual,
|
|
@"error",
|
|
|
|
pub const Map = bun.ComptimeStringMap(FetchRedirect, .{
|
|
.{ "follow", .follow },
|
|
.{ "manual", .manual },
|
|
.{ "error", .@"error" },
|
|
});
|
|
};
|
|
|
|
const bun = @import("bun");
|