-
Notifications
You must be signed in to change notification settings - Fork 10.3k
/
Copy pathStatusCodes.cs
148 lines (140 loc) · 5.48 KB
/
StatusCodes.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Globalization;
using System.Text;
namespace System.Net.Http.HPack;
internal static partial class StatusCodes
{
public static string ToStatusString(int statusCode)
{
switch (statusCode)
{
case (int)HttpStatusCode.Continue:
return "100";
case (int)HttpStatusCode.SwitchingProtocols:
return "101";
case (int)HttpStatusCode.Processing:
return "102";
case (int)HttpStatusCode.OK:
return "200";
case (int)HttpStatusCode.Created:
return "201";
case (int)HttpStatusCode.Accepted:
return "202";
case (int)HttpStatusCode.NonAuthoritativeInformation:
return "203";
case (int)HttpStatusCode.NoContent:
return "204";
case (int)HttpStatusCode.ResetContent:
return "205";
case (int)HttpStatusCode.PartialContent:
return "206";
case (int)HttpStatusCode.MultiStatus:
return "207";
case (int)HttpStatusCode.AlreadyReported:
return "208";
case (int)HttpStatusCode.IMUsed:
return "226";
case (int)HttpStatusCode.MultipleChoices:
return "300";
case (int)HttpStatusCode.MovedPermanently:
return "301";
case (int)HttpStatusCode.Found:
return "302";
case (int)HttpStatusCode.SeeOther:
return "303";
case (int)HttpStatusCode.NotModified:
return "304";
case (int)HttpStatusCode.UseProxy:
return "305";
case (int)HttpStatusCode.Unused:
return "306";
case (int)HttpStatusCode.TemporaryRedirect:
return "307";
case (int)HttpStatusCode.PermanentRedirect:
return "308";
case (int)HttpStatusCode.BadRequest:
return "400";
case (int)HttpStatusCode.Unauthorized:
return "401";
case (int)HttpStatusCode.PaymentRequired:
return "402";
case (int)HttpStatusCode.Forbidden:
return "403";
case (int)HttpStatusCode.NotFound:
return "404";
case (int)HttpStatusCode.MethodNotAllowed:
return "405";
case (int)HttpStatusCode.NotAcceptable:
return "406";
case (int)HttpStatusCode.ProxyAuthenticationRequired:
return "407";
case (int)HttpStatusCode.RequestTimeout:
return "408";
case (int)HttpStatusCode.Conflict:
return "409";
case (int)HttpStatusCode.Gone:
return "410";
case (int)HttpStatusCode.LengthRequired:
return "411";
case (int)HttpStatusCode.PreconditionFailed:
return "412";
case (int)HttpStatusCode.RequestEntityTooLarge:
return "413";
case (int)HttpStatusCode.RequestUriTooLong:
return "414";
case (int)HttpStatusCode.UnsupportedMediaType:
return "415";
case (int)HttpStatusCode.RequestedRangeNotSatisfiable:
return "416";
case (int)HttpStatusCode.ExpectationFailed:
return "417";
case (int)418:
return "418";
case (int)419:
return "419";
case (int)HttpStatusCode.MisdirectedRequest:
return "421";
case (int)HttpStatusCode.UnprocessableEntity:
return "422";
case (int)HttpStatusCode.Locked:
return "423";
case (int)HttpStatusCode.FailedDependency:
return "424";
case (int)HttpStatusCode.UpgradeRequired:
return "426";
case (int)HttpStatusCode.PreconditionRequired:
return "428";
case (int)HttpStatusCode.TooManyRequests:
return "429";
case (int)HttpStatusCode.RequestHeaderFieldsTooLarge:
return "431";
case (int)HttpStatusCode.UnavailableForLegalReasons:
return "451";
case (int)HttpStatusCode.InternalServerError:
return "500";
case (int)HttpStatusCode.NotImplemented:
return "501";
case (int)HttpStatusCode.BadGateway:
return "502";
case (int)HttpStatusCode.ServiceUnavailable:
return "503";
case (int)HttpStatusCode.GatewayTimeout:
return "504";
case (int)HttpStatusCode.HttpVersionNotSupported:
return "505";
case (int)HttpStatusCode.VariantAlsoNegotiates:
return "506";
case (int)HttpStatusCode.InsufficientStorage:
return "507";
case (int)HttpStatusCode.LoopDetected:
return "508";
case (int)HttpStatusCode.NotExtended:
return "510";
case (int)HttpStatusCode.NetworkAuthenticationRequired:
return "511";
default:
return statusCode.ToString(CultureInfo.InvariantCulture);
}
}
}