mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
simplify statusText
Some checks failed
e2e-test / zig build release (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
Some checks failed
e2e-test / zig build release (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
This commit is contained in:
@@ -316,7 +316,7 @@ pub fn httpRequestComplete(arena: Allocator, bc: anytype, request: *const Notifi
|
|||||||
.response = .{
|
.response = .{
|
||||||
.url = url,
|
.url = url,
|
||||||
.status = request.status,
|
.status = request.status,
|
||||||
.statusText = statusText(request.status),
|
.statusText = @as(std.http.Status, @enumFromInt(request.status)).phrase() orelse "Unknown",
|
||||||
.headers = std.json.ArrayHashMap([]const u8){ .map = headers },
|
.headers = std.json.ArrayHashMap([]const u8){ .map = headers },
|
||||||
},
|
},
|
||||||
.frameId = target_id,
|
.frameId = target_id,
|
||||||
@@ -329,79 +329,6 @@ fn urlToString(arena: Allocator, url: *const std.Uri, opts: std.Uri.WriteToStrea
|
|||||||
return buf.items;
|
return buf.items;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn statusText(status: u16) []const u8 {
|
|
||||||
switch (status) {
|
|
||||||
100 => return "Continue",
|
|
||||||
101 => return "Switching Protocols",
|
|
||||||
102 => return "Processing",
|
|
||||||
103 => return "Early Hints",
|
|
||||||
|
|
||||||
200 => return "OK",
|
|
||||||
201 => return "Created",
|
|
||||||
202 => return "Accepted",
|
|
||||||
203 => return "Non-Authoritative Information",
|
|
||||||
204 => return "No Content",
|
|
||||||
205 => return "Reset Content",
|
|
||||||
206 => return "Partial Content",
|
|
||||||
207 => return "Multi-Status",
|
|
||||||
208 => return "Already Reported",
|
|
||||||
226 => return "IM Used",
|
|
||||||
|
|
||||||
300 => return "Multiple Choices",
|
|
||||||
301 => return "Moved Permanently",
|
|
||||||
302 => return "Found",
|
|
||||||
303 => return "See Other",
|
|
||||||
304 => return "Not Modified",
|
|
||||||
305 => return "Use Proxy",
|
|
||||||
306 => return "Switch Proxy",
|
|
||||||
307 => return "Temporary Redirect",
|
|
||||||
308 => return "Permanent Redirect",
|
|
||||||
|
|
||||||
400 => return "Bad Request",
|
|
||||||
401 => return "Unauthorized",
|
|
||||||
402 => return "Payment Required",
|
|
||||||
403 => return "Forbidden",
|
|
||||||
404 => return "Not Found",
|
|
||||||
405 => return "Method Not Allowed",
|
|
||||||
406 => return "Not Acceptable",
|
|
||||||
407 => return "Proxy Authentication Required",
|
|
||||||
408 => return "Request Timeout",
|
|
||||||
409 => return "Conflict",
|
|
||||||
410 => return "Gone",
|
|
||||||
411 => return "Length Required",
|
|
||||||
412 => return "Precondition Failed",
|
|
||||||
413 => return "Payload Too Large",
|
|
||||||
414 => return "URI Too Long",
|
|
||||||
415 => return "Unsupported Media Type",
|
|
||||||
416 => return "Range Not Satisfiable",
|
|
||||||
417 => return "Expectation Failed",
|
|
||||||
418 => return "I'm a teapot",
|
|
||||||
421 => return "Misdirected Request",
|
|
||||||
422 => return "Unprocessable Entity",
|
|
||||||
423 => return "Locked",
|
|
||||||
424 => return "Failed Dependency",
|
|
||||||
425 => return "Too Early",
|
|
||||||
426 => return "Upgrade Required",
|
|
||||||
428 => return "Precondition Required",
|
|
||||||
429 => return "Too Many Requests",
|
|
||||||
431 => return "Request Header Fields Too Large",
|
|
||||||
451 => return "Unavailable For Legal Reasons",
|
|
||||||
|
|
||||||
500 => return "Internal Server Error",
|
|
||||||
501 => return "Not Implemented",
|
|
||||||
502 => return "Bad Gateway",
|
|
||||||
503 => return "Service Unavailable",
|
|
||||||
504 => return "Gateway Timeout",
|
|
||||||
505 => return "HTTP Version Not Supported",
|
|
||||||
506 => return "Variant Also Negotiates",
|
|
||||||
507 => return "Insufficient Storage",
|
|
||||||
508 => return "Loop Detected",
|
|
||||||
510 => return "Not Extended",
|
|
||||||
511 => return "Network Authentication Required",
|
|
||||||
else => return "Unknown",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const testing = @import("../testing.zig");
|
const testing = @import("../testing.zig");
|
||||||
test "cdp.network setExtraHTTPHeaders" {
|
test "cdp.network setExtraHTTPHeaders" {
|
||||||
var ctx = testing.context();
|
var ctx = testing.context();
|
||||||
|
|||||||
Reference in New Issue
Block a user