Added missing status code 429 Too Many Requests#26415
Added missing status code 429 Too Many Requests#26415KeithHenry wants to merge 3 commits intodotnet:masterfrom
Conversation
This enumeration is missing HTTP status code 429 Too Many Requests - this is used my many rate-limited services to indicate that the current allocation has been exceeded. For example the British governments companies registry service does this: https://developer.companieshouse.gov.uk/api/docs/index/gettingStarted/rateLimiting.html .NET should be able to handle and create responses with this status code.
| ExpectationFailed = 417, | ||
|
|
||
| UpgradeRequired = 426, | ||
| TooManyRequests = 429, |
There was a problem hiding this comment.
If adding one status from RFC 6585, it seems reasonable to add the rest (428, 431 & 511) at the same time.
There was a problem hiding this comment.
It does, though only 429 is causing me a problem. Shall I add that commit?
Following comment on PR added all the codes from https://tools.ietf.org/html/rfc6585
|
cc: @karelz Thx for the PR. However, this is an API change and would require changes to the REF folder. In addition, there is an API review process that needs to be followed first. We are also tracking adding new values to this enumeration here: #4382. So, it would probably be best to close this PR and to use issue #4382 to propose the full set of additions to this enumeration. |
|
Cheers @davidsh, I've updated the copy in the ref folder. Adding enums is an API change? If so it has to be one that can change quickly (well, relatively, RFC 6585 being from 2012 and #4382 from 2015), and while HTTP codes are a standard has it been decided that .NET's To be honest I think this needs an API change. I mean that I just want to get this bug fixed (and it is a bug). |
|
@KeithHenry Touching any public surface is API change. API review checks also name consistency with other BCL types, etc.
Definition of bug vs. feature is often biased opinion. Nevertheless, we should run it by API review first. It may take a week or two as we are super-busy reviewing APIs critical for 2.1 at this moment (just to set expectations). |
|
@karelz am I missing something?
This started because I have an external API that returns code 429 once a limit has been reached - either WinHTTP or cURL could handle that result, but Is there some way to get the underlying code from
I understand that, but this enum is not coming from a source internal to .NET - is this .NET's API to regulate?
#4382 is 3 years old. Is there a way to push for a review sooner or help it along? |
|
@KeithHenry I think there is a set of misunderstandings here ...
Enums can hold any value of the underlying type (int in this case). The enum is just about pretty easy-to-use names. Existence of an easy name is not going to make something magically work. Technically speaking, you can use the "missing" codes even today.
I don't follow. Did you mean external source? Either way, names are something that is also API-reviewed. I don't expect it to take longer than few minutes, but it is something we should do.
Technically, the issue is closer to 2 years old. I agree that it would be nice to have it done already, given how simple it is. |
|
@KeithHenry Thank you very much for your PR on this. The .NET Core team was able to close on the expanded set of A new PR #26727 was opened up that now supersedes this PR. So, I'll close this PR. |
This enumeration is missing HTTP status code 429 Too Many Requests - this is used by many rate-limited services to indicate that the current allocation has been exceeded.
For example the British government's companies registry service does this: https://developer.companieshouse.gov.uk/api/docs/index/gettingStarted/rateLimiting.html
.NET should be able to handle and create responses with this status code.