mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-10-09 04:42:30 -04:00
webapi: xhr/fetch report status reason from server
If the server gives a status reason, report it as-is. Only default to the zig code->reason map when one isn't given. Also, don't force a 407 status code when auth_challenge is present.
This commit is contained in:
6 files changed
+133
-6
No files matched your search
@@ -884,6 +884,22 @@ fn testHTTPHandler(req: *std.http.Server.Request) !void {
|
||||
return req.respond("", .{ .status = @enumFromInt(code) });
|
||||
}
|
||||
|
||||
if (std.mem.eql(u8, path, "/xhr/reason")) {
|
||||
return req.respond("", .{
|
||||
.status = .service_unavailable,
|
||||
.reason = "HOUSTON WE HAVE A",
|
||||
});
|
||||
}
|
||||
|
||||
if (std.mem.eql(u8, path, "/xhr/401")) {
|
||||
return req.respond("No", .{
|
||||
.status = .unauthorized,
|
||||
.extra_headers = &.{
|
||||
.{ .name = "WWW-Authenticate", .value = "Basic realm=\"test\"" },
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (std.mem.eql(u8, path, "/xhr/500")) {
|
||||
return req.respond("Internal Server Error", .{
|
||||
.status = .internal_server_error,
|
||||
|
||||
Reference in new issue
Block a user