Skip to content

Commit d598636

Browse files
authored
Remove Microsoft.AspNetCore.WebUtilities dependency (#2324)
1 parent 06ce60a commit d598636

File tree

2 files changed

+79
-3
lines changed

2 files changed

+79
-3
lines changed

lib/PuppeteerSharp/Messaging/FetchFulfillRequest.cs

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,92 @@
11
using System.Collections.Generic;
2-
using Microsoft.AspNetCore.WebUtilities;
32

43
namespace PuppeteerSharp.Messaging
54
{
65
internal class FetchFulfillRequest
76
{
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+
874
public string RequestId { get; set; }
975

1076
public int ResponseCode { get; set; }
1177

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+
}
1390

1491
public Header[] ResponseHeaders { get; set; }
1592

lib/PuppeteerSharp/PuppeteerSharp.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
<ItemGroup>
3030
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.2" />
3131
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
32-
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
3332
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.0" />
3433
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
3534
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507">

0 commit comments

Comments
 (0)