Putting detailed REST error message in HTTP Warning header, good/bad idea?

前端 未结 6 1210
鱼传尺愫
鱼传尺愫 2020-12-29 01:52

We are developing a standard REST service using HTTP status codes as its response code if something went wrong. (e.g. invalid user input would return \"400 Bad Request\" to

6条回答
  •  时光取名叫无心
    2020-12-29 02:30

    429 Too Many Requests (RFC 6585) The user has sent too many requests in a given amount of time. Intended for use with rate limiting schemes.

    Since you are allowing one request per lifetime, you are implementing a rate limiting scheme, so this is the appropriate HTTP response.

    You can also (and are encouraged by the HTTP spec) to customize the HTTP Response body, so you can change "Too Many Requests" to any explanation you want.

提交回复
热议问题