Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 504781c

Browse files
authored
Update HttpStatusCode enum (#26727)
* Update HttpStatusCode enum * address feedback
1 parent a9ceaaf commit 504781c

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/System.Net.Primitives/ref/System.Net.Primitives.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,52 +126,71 @@ protected EndPoint() { }
126126
public enum HttpStatusCode
127127
{
128128
Accepted = 202,
129+
AlreadyReported = 208,
129130
Ambiguous = 300,
130131
BadGateway = 502,
131132
BadRequest = 400,
132133
Conflict = 409,
133134
Continue = 100,
134135
Created = 201,
136+
EarlyHints = 103,
135137
ExpectationFailed = 417,
138+
FailedDependency = 424,
136139
Forbidden = 403,
137140
Found = 302,
138141
GatewayTimeout = 504,
139142
Gone = 410,
140143
HttpVersionNotSupported = 505,
144+
IMUsed = 226,
145+
InsufficientStorage = 507,
141146
InternalServerError = 500,
142147
LengthRequired = 411,
148+
Locked = 423,
149+
LoopDetected = 508,
143150
MethodNotAllowed = 405,
151+
MisdirectedRequest = 421,
144152
Moved = 301,
145153
MovedPermanently = 301,
146154
MultipleChoices = 300,
155+
MultiStatus = 207,
156+
NetworkAuthenticationRequired = 511,
147157
NoContent = 204,
148158
NonAuthoritativeInformation = 203,
149159
NotAcceptable = 406,
160+
NotExtended = 510,
150161
NotFound = 404,
151162
NotImplemented = 501,
152163
NotModified = 304,
153164
OK = 200,
154165
PartialContent = 206,
155166
PaymentRequired = 402,
167+
PermanentRedirect = 308,
156168
PreconditionFailed = 412,
169+
PreconditionRequired = 428,
170+
Processing = 102,
157171
ProxyAuthenticationRequired = 407,
158172
Redirect = 302,
159173
RedirectKeepVerb = 307,
160174
RedirectMethod = 303,
161175
RequestedRangeNotSatisfiable = 416,
162176
RequestEntityTooLarge = 413,
177+
RequestHeaderFieldsTooLarge = 431,
163178
RequestTimeout = 408,
164179
RequestUriTooLong = 414,
165180
ResetContent = 205,
166181
SeeOther = 303,
167182
ServiceUnavailable = 503,
168183
SwitchingProtocols = 101,
169184
TemporaryRedirect = 307,
185+
TooManyRequests = 429,
170186
Unauthorized = 401,
187+
UnavailableForLegalReasons = 451,
188+
UnprocessableEntity = 422,
171189
UnsupportedMediaType = 415,
172190
Unused = 306,
173191
UpgradeRequired = 426,
174192
UseProxy = 305,
193+
VariantAlsoNegotiates = 506
175194
}
176195
public partial interface ICredentials
177196
{

src/System.Net.Primitives/src/System/Net/HttpStatusCode.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ public enum HttpStatusCode
1010
// Informational 1xx
1111
Continue = 100,
1212
SwitchingProtocols = 101,
13+
Processing = 102,
14+
EarlyHints = 103,
1315

1416
// Successful 2xx
1517
OK = 200,
@@ -19,6 +21,10 @@ public enum HttpStatusCode
1921
NoContent = 204,
2022
ResetContent = 205,
2123
PartialContent = 206,
24+
MultiStatus = 207,
25+
AlreadyReported = 208,
26+
27+
IMUsed = 226,
2228

2329
// Redirection 3xx
2430
MultipleChoices = 300,
@@ -34,6 +40,7 @@ public enum HttpStatusCode
3440
Unused = 306,
3541
TemporaryRedirect = 307,
3642
RedirectKeepVerb = 307,
43+
PermanentRedirect = 308,
3744

3845
// Client Error 4xx
3946
BadRequest = 400,
@@ -54,15 +61,37 @@ public enum HttpStatusCode
5461
UnsupportedMediaType = 415,
5562
RequestedRangeNotSatisfiable = 416,
5663
ExpectationFailed = 417,
64+
// From the discussion thread on #4382:
65+
// "It would be a mistake to add it to .NET now. See golang/go#21326,
66+
// nodejs/node#14644, requests/requests#4238 and aspnet/HttpAbstractions#915".
67+
// ImATeapot = 418
68+
69+
MisdirectedRequest = 421,
70+
UnprocessableEntity = 422,
71+
Locked = 423,
72+
FailedDependency = 424,
5773

5874
UpgradeRequired = 426,
5975

76+
PreconditionRequired = 428,
77+
TooManyRequests = 429,
78+
79+
RequestHeaderFieldsTooLarge = 431,
80+
81+
UnavailableForLegalReasons = 451,
82+
6083
// Server Error 5xx
6184
InternalServerError = 500,
6285
NotImplemented = 501,
6386
BadGateway = 502,
6487
ServiceUnavailable = 503,
6588
GatewayTimeout = 504,
6689
HttpVersionNotSupported = 505,
90+
VariantAlsoNegotiates = 506,
91+
InsufficientStorage = 507,
92+
LoopDetected = 508,
93+
94+
NotExtended = 510,
95+
NetworkAuthenticationRequired = 511
6796
}
6897
}

0 commit comments

Comments
 (0)