zoukankan      html  css  js  c++  java
  • 因为在HttpGet请求中使用body传输json,被老板骂了

    因为在HttpGet请求中使用body传输json,被老板骂了,说我不懂http协议,但是http协议没有规定不能这么做啊??

    RFC 7231, section 4.3.1: GET

    The GET method requests transfer of a current selected representation    for the target resource.  
    GET is the primary mechanism of information    retrieval and the focus of almost all performance optimizations.    
    Hence, when people speak of retrieving some identifiable information    via HTTP, they are generally referring to making a GET request.    
     It is tempting to think of resource identifiers as remote file system    pathnames and of representations as being a copy of the contents of    such files. 
     In fact, that is how many resources are implemented (see    [Section 9.1](about:blank#section-9.1) for related security considerations). 
     However, there are    no such limitations in practice.  
    The HTTP interface for a resource    is just as likely to be implemented as a tree of content objects, 
    a programmatic view on various database records, or a gateway to other information systems.
    Even when the URI mapping mechanism is tied to a file system, an origin server might be configured to execute the files with the request as input and send the output as the representation rather than transfer the files directly.
    Regardless, only the origin server needs to know how each of its resource identifiers corresponds to an implementation and how each implementation manages to select and send a current representation of the target resource in a response to GET.
    A client can alter the semantics of GET to be a "range request", requesting transfer of only some part(s) of the selected representation, by sending a Range header field in the request ([[RFC7233](https://tools.ietf.org/html/rfc7233)]).
    A payload within a GET request message has no defined semantics;
    sending a payload body on a GET request might cause some existing implementations to reject the request.
    The response to a GET request is cacheable; a cache MAY use it to satisfy subsequent GET and HEAD requests unless otherwise indicated by the Cache-Control header field ([Section 5.2 of [RFC7234]](
    https://tools.ietf.org/html/rfc7234#section-5.2)).

     客户端方面:

    swagger不支持:

     但是最新版本的postman可以支持:

  • 相关阅读:
    C#操作AD及Exchange Server总结(二)
    YUV采样及存储格式
    windows主线程等待子线程退出卡死问题
    fastdb中的位图应用
    【转】浏览器的跨域访问
    【转】linux线程模型
    【转】STL空间配置器
    【转】C++ 内存分配(new,operator new)详解
    Java并发问题--乐观锁与悲观锁以及乐观锁的一种实现方式-CAS
    idea启动项目address localhost:1099 is already in use异常解决
  • 原文地址:https://www.cnblogs.com/25miao/p/15579365.html
Copyright © 2011-2022 走看看