rest - "EULA not accepted"的 HTTP 状态代码?

标签 rest http http-status-codes

我有一个 RESTful 网络服务,需要接受最终用户许可协议(protocol) (EULA) 才能使用。

如果 EULA(尚未)被接受,哪个 HTTP 状态代码最适合网络服务返回?

目前我看到以下可能性(我目前最喜欢的粗体):

  • 403 禁止
  • 412 前提条件失败
  • 417 期望失败
  • 423锁定
  • 428 需要先决条件#
  • 451 因法律原因无法使用

最佳答案

根据 CodeCaster 的建议我去了 w3.org 并查看了 definitions of HTTP Status Codes in RFC2616 .我发现状态码 403 最合适:

10.4.4 403 Forbidden

The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.

关于rest - "EULA not accepted"的 HTTP 状态代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34720726/

相关文章:

java - 客户端 JAX-RS 异步请求

javascript - rxjs simple do http get 什么也不做

java - 使用 http post 将文件上传到本地主机?

python - 为什么不建议在响应中使用裸 HTTP 状态代码?

python - Scrapy 和响应状态码 : how to check against it?

php - 带有 REST PHP 的 PayPal 返回错误 400

c# - UrlHelper 在生成 URI 时不使用引用主机

java - 在 Spring 通过响应返回组的最佳方式

Angular2 observable http获取条件重复

http - 未登录与未在 RESTful API 中授权的不同 HTTP 状态