这应该是GET还是PATCH请求?

编程入门 行业动态 更新时间:2024-10-23 15:20:31
本文介绍了这应该是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请求?

本文发布于:2023-11-15 21:22:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1598065.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:这应   PATCH

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!