1

I realize this is not recommended, but I'm wondering what the URL would look like, for example:

http://myserver.com/rest/info?param1=foo&param2=bar

how would you append a body to that URL, I don't think &body would work.

Reason I'm looking at this is I'm looking for a way around a rather limited preset access to CURL from within my chosen language, so I'm wondering if I can use GET somehow instead of POST.

EDIT: Several people marked this as a duplicate of another question, but the essence of my question was "What would the body look like" where the other question is and I quote here from the other post:

My questions:

Is this a good idea altogether? Will HTTP clients have issues with using request bodies within a GET request?

Therefore I don't believe this is a duplicate at all, I believe those who marked it as such perhaps didn't really read either question much beyond the title.

Community
  • 1
  • 1
alphablender
  • 2,011
  • 4
  • 25
  • 40

1 Answers1

2

The URL wouldn't change by adding a body to the HTTP request. In addition to the normal HTTP headers your request would also include a body (separated from the header by a blank line).

I would strongly recommend that you DON'T do this with GET requests though - it is not well treated with HTTP servers and is somewhat wrong if you want to follow and respect the HTTP specification.

A simple request would look something like this:

GET /whatever HTTP/1.1
Host: foobar.com
User-Agent: Selfmade telnet
Connection: close

hello world
Michael Banzon
  • 4,686
  • 1
  • 24
  • 27