这应该是GET还是PATCH请求? [英] Should this be a GET or a PATCH request?

查看:108
本文介绍了这应该是GET还是PATCH请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我请求从数据库中获取一些数据而不发送任何更新,但是我正在标记数据库中的记录说数据已被获取,这是否使其成为PATCH请求或GET? /p>

if i do a request to get some data from a database without sending any updates, however i'm marking the record in the database to say the data has been fetched, does that make it a PATCH request or a GET?

推荐答案

简短的回答:不,它仍然是GET.

Short answer: No, it is still a GET.

RFC 7231定义安全

RFC 7231 defines safe

如果请求方法的定义语义本质上是只读的,则将其视为安全".

Request methods are considered "safe" if their defined semantics are essentially read-only....

此安全方法的定义不会阻止实施 包括可能有害的行为,而不是 完全只读,或者在调用安全性时引起副作用 方法.然而,重要的是客户没有 要求采取其他行为,并且不承担任何责任 它.例如,大多数服务器会附加请求信息以进行访问 每个响应完成后的日志文件,无论 方法,即使日志存储可能会被认为是安全的 变满并使服务器崩溃.同样,启动了安全请求 通过选择网络上的广告经常会拥有侧面 充值广告帐户的效果.

This definition of safe methods does not prevent an implementation from including behavior that is potentially harmful, that is not entirely read-only, or that causes side effects while invoking a safe method. What is important, however, is that the client did not request that additional behavior and cannot be held accountable for it. For example, most servers append request information to access log files at the completion of every response, regardless of the method, and that is considered safe even though the log storage might become full and crash the server. Likewise, a safe request initiated by selecting an advertisement on the Web will often have the side effect of charging an advertising account.

因此,如果客户端尝试检索资源的当前表示形式, 您的实现恰好在一边做一些记账的事实并不会改变请求的语义.

So if the client is trying to retrieve a current representation of the resource, the fact that your implementation happens to do a bit of bookkeeping on the side doesn't change the semantics of the request.

HTTP前端的部分功能是使客户端与服务器的基础实现细节完全隔离-一切从外部看起来都像是一个愚蠢的网站.

Part of the point of an HTTP front end is that clients are completely insulated from the underlying implementation details of the server -- everything looks like a dumb web site from the outside.

这篇关于这应该是GET还是PATCH请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆