Passing JSON data in get request as request body

后端 未结 2 913
心在旅途
心在旅途 2021-01-02 05:57

Hi i have to send a get request to an url
http://onemoredemo.appspot.com/group?authToken=access_token&authMethod=oauth

with request body contains json object

相关标签:
2条回答
  • 2021-01-02 06:15

    Don't do it.

    Read this: http://tech.groups.yahoo.com/group/rest-discuss/message/9962

    "Yes. In other words, any HTTP request message is allowed to contain a message body, and thus must parse messages with that in mind. Server semantics for GET, however, are restricted such that a body, if any, has no semantic meaning to the request. The requirements on parsing are separate from the requirements on method semantics.

    So, yes, you can send a body with GET, and no, it is never useful to do so.

    This is part of the layered design of HTTP/1.1 that will become clear again once the spec is partitioned (work in progress)."

    For other interesting discussions on this check this:

    https://stackoverflow.com/a/978094/550967

    https://stackoverflow.com/a/978173/550967

    https://stackoverflow.com/a/978519/550967

    0 讨论(0)
  • 2021-01-02 06:26

    The body of a GET request is not read.

    Have you tried adding it to the params:

    http://onemoredemo.appspot.com/group?authToken=access_token&authMethod=oauth&goupid=some_variable

    0 讨论(0)
提交回复
热议问题