@@ -316,7 +316,7 @@ pub fn httpRequestComplete(arena: Allocator, bc: anytype, request: *const Notifi
316316 .response = .{
317317 .url = url ,
318318 .status = request .status ,
319- .statusText = statusText ( request .status ),
319+ .statusText = @as ( std . http . Status , @enumFromInt ( request .status )). phrase () orelse "Unknown" ,
320320 .headers = std .json .ArrayHashMap ([]const u8 ){ .map = headers },
321321 },
322322 .frameId = target_id ,
@@ -329,79 +329,6 @@ fn urlToString(arena: Allocator, url: *const std.Uri, opts: std.Uri.WriteToStrea
329329 return buf .items ;
330330}
331331
332- fn statusText (status : u16 ) []const u8 {
333- switch (status ) {
334- 100 = > return "Continue" ,
335- 101 = > return "Switching Protocols" ,
336- 102 = > return "Processing" ,
337- 103 = > return "Early Hints" ,
338-
339- 200 = > return "OK" ,
340- 201 = > return "Created" ,
341- 202 = > return "Accepted" ,
342- 203 = > return "Non-Authoritative Information" ,
343- 204 = > return "No Content" ,
344- 205 = > return "Reset Content" ,
345- 206 = > return "Partial Content" ,
346- 207 = > return "Multi-Status" ,
347- 208 = > return "Already Reported" ,
348- 226 = > return "IM Used" ,
349-
350- 300 = > return "Multiple Choices" ,
351- 301 = > return "Moved Permanently" ,
352- 302 = > return "Found" ,
353- 303 = > return "See Other" ,
354- 304 = > return "Not Modified" ,
355- 305 = > return "Use Proxy" ,
356- 306 = > return "Switch Proxy" ,
357- 307 = > return "Temporary Redirect" ,
358- 308 = > return "Permanent Redirect" ,
359-
360- 400 = > return "Bad Request" ,
361- 401 = > return "Unauthorized" ,
362- 402 = > return "Payment Required" ,
363- 403 = > return "Forbidden" ,
364- 404 = > return "Not Found" ,
365- 405 = > return "Method Not Allowed" ,
366- 406 = > return "Not Acceptable" ,
367- 407 = > return "Proxy Authentication Required" ,
368- 408 = > return "Request Timeout" ,
369- 409 = > return "Conflict" ,
370- 410 = > return "Gone" ,
371- 411 = > return "Length Required" ,
372- 412 = > return "Precondition Failed" ,
373- 413 = > return "Payload Too Large" ,
374- 414 = > return "URI Too Long" ,
375- 415 = > return "Unsupported Media Type" ,
376- 416 = > return "Range Not Satisfiable" ,
377- 417 = > return "Expectation Failed" ,
378- 418 = > return "I'm a teapot" ,
379- 421 = > return "Misdirected Request" ,
380- 422 = > return "Unprocessable Entity" ,
381- 423 = > return "Locked" ,
382- 424 = > return "Failed Dependency" ,
383- 425 = > return "Too Early" ,
384- 426 = > return "Upgrade Required" ,
385- 428 = > return "Precondition Required" ,
386- 429 = > return "Too Many Requests" ,
387- 431 = > return "Request Header Fields Too Large" ,
388- 451 = > return "Unavailable For Legal Reasons" ,
389-
390- 500 = > return "Internal Server Error" ,
391- 501 = > return "Not Implemented" ,
392- 502 = > return "Bad Gateway" ,
393- 503 = > return "Service Unavailable" ,
394- 504 = > return "Gateway Timeout" ,
395- 505 = > return "HTTP Version Not Supported" ,
396- 506 = > return "Variant Also Negotiates" ,
397- 507 = > return "Insufficient Storage" ,
398- 508 = > return "Loop Detected" ,
399- 510 = > return "Not Extended" ,
400- 511 = > return "Network Authentication Required" ,
401- else = > return "Unknown" ,
402- }
403- }
404-
405332const testing = @import ("../testing.zig" );
406333test "cdp.network setExtraHTTPHeaders" {
407334 var ctx = testing .context ();
0 commit comments