错误处理后的 HTTP 响应
HTTP response after error handling
所以,我在这里看到了几个与我相关的问题,但我想描述一个更具体的情况。想象一下,您的 API 总是检查每天向入口点发出的请求量。一旦特定客户端达到此限制,我将返回 422 - "Unprocessable entity".
我想我只是想咨询一下是否有人有不同的做法。
每当向您的服务器发出过多请求时,您始终可以使用 HTTP 429:请求过多 进行响应。 Check the RFC.
The 429 status code indicates that the user has sent too many requests
in a given amount of time ("rate limiting").
The response representations SHOULD include details explaining the
condition, and MAY include a Retry-After header indicating how long to
wait before making a new request.
For example:
HTTP/1.1 429 Too Many Requests
Content-Type: text/html
Retry-After: 3600
..body..
所以,我在这里看到了几个与我相关的问题,但我想描述一个更具体的情况。想象一下,您的 API 总是检查每天向入口点发出的请求量。一旦特定客户端达到此限制,我将返回 422 - "Unprocessable entity".
我想我只是想咨询一下是否有人有不同的做法。
每当向您的服务器发出过多请求时,您始终可以使用 HTTP 429:请求过多 进行响应。 Check the RFC.
The 429 status code indicates that the user has sent too many requests in a given amount of time ("rate limiting").
The response representations SHOULD include details explaining the condition, and MAY include a Retry-After header indicating how long to wait before making a new request.
For example:
HTTP/1.1 429 Too Many Requests
Content-Type: text/html
Retry-After: 3600
..body..