|
1 | 1 | using System.Collections.Generic; |
2 | | -using Microsoft.AspNetCore.WebUtilities; |
3 | 2 |
|
4 | 3 | namespace PuppeteerSharp.Messaging |
5 | 4 | { |
6 | 5 | internal class FetchFulfillRequest |
7 | 6 | { |
| 7 | + private static readonly Dictionary<int, string> StatusTexts = new() |
| 8 | + { |
| 9 | + [100] = "Continue", |
| 10 | + [101] = "Switching Protocols", |
| 11 | + [102] = "Processing", |
| 12 | + [103] = "Early Hints", |
| 13 | + [200] = "OK", |
| 14 | + [201] = "Created", |
| 15 | + [202] = "Accepted", |
| 16 | + [203] = "Non-Authoritative Information", |
| 17 | + [204] = "No Content", |
| 18 | + [205] = "Reset Content", |
| 19 | + [206] = "Partial Content", |
| 20 | + [207] = "Multi-Status", |
| 21 | + [208] = "Already Reported", |
| 22 | + [226] = "IM Used", |
| 23 | + [300] = "Multiple Choices", |
| 24 | + [301] = "Moved Permanently", |
| 25 | + [302] = "Found", |
| 26 | + [303] = "See Other", |
| 27 | + [304] = "Not Modified", |
| 28 | + [305] = "Use Proxy", |
| 29 | + [306] = "Switch Proxy", |
| 30 | + [307] = "Temporary Redirect", |
| 31 | + [308] = "Permanent Redirect", |
| 32 | + [400] = "Bad Request", |
| 33 | + [401] = "Unauthorized", |
| 34 | + [402] = "Payment Required", |
| 35 | + [403] = "Forbidden", |
| 36 | + [404] = "Not Found", |
| 37 | + [405] = "Method Not Allowed", |
| 38 | + [406] = "Not Acceptable", |
| 39 | + [407] = "Proxy Authentication Required", |
| 40 | + [408] = "Request Timeout", |
| 41 | + [409] = "Conflict", |
| 42 | + [410] = "Gone", |
| 43 | + [411] = "Length Required", |
| 44 | + [412] = "Precondition Failed", |
| 45 | + [413] = "Payload Too Large", |
| 46 | + [414] = "URI Too Long", |
| 47 | + [415] = "Unsupported Media Type", |
| 48 | + [416] = "Range Not Satisfiable", |
| 49 | + [417] = "Expectation Failed", |
| 50 | + [418] = "I'm a teapot", |
| 51 | + [421] = "Misdirected Request", |
| 52 | + [422] = "Unprocessable Entity", |
| 53 | + [423] = "Locked", |
| 54 | + [424] = "Failed Dependency", |
| 55 | + [425] = "Too Early", |
| 56 | + [426] = "Upgrade Required", |
| 57 | + [428] = "Precondition Required", |
| 58 | + [429] = "Too Many Requests", |
| 59 | + [431] = "Request Header Fields Too Large", |
| 60 | + [451] = "Unavailable For Legal Reasons", |
| 61 | + [500] = "Internal Server Error", |
| 62 | + [501] = "Not Implemented", |
| 63 | + [502] = "Bad Gateway", |
| 64 | + [503] = "Service Unavailable", |
| 65 | + [504] = "Gateway Timeout", |
| 66 | + [505] = "HTTP Version Not Supported", |
| 67 | + [506] = "Variant Also Negotiates", |
| 68 | + [507] = "Insufficient Storage", |
| 69 | + [508] = "Loop Detected", |
| 70 | + [510] = "Not Extended", |
| 71 | + [511] = "Network Authentication Required", |
| 72 | + }; |
| 73 | + |
8 | 74 | public string RequestId { get; set; } |
9 | 75 |
|
10 | 76 | public int ResponseCode { get; set; } |
11 | 77 |
|
12 | | - public string ResponsePhrase => ReasonPhrases.GetReasonPhrase(ResponseCode); |
| 78 | + public string ResponsePhrase |
| 79 | + { |
| 80 | + get |
| 81 | + { |
| 82 | + if (StatusTexts.ContainsKey(ResponseCode)) |
| 83 | + { |
| 84 | + return StatusTexts[ResponseCode]; |
| 85 | + } |
| 86 | + |
| 87 | + return "Unknown Status Code"; |
| 88 | + } |
| 89 | + } |
13 | 90 |
|
14 | 91 | public Header[] ResponseHeaders { get; set; } |
15 | 92 |
|
|
0 commit comments