Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

what is request body?  RSS feed

 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear sir i would like to know one thing that with GET method data is setnt in request as query string but in POST method data are sent in request body.
Now confusion here is that what is request body?

with regard

Arun kumar maalik
 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A HTTPRequest has a header and body. Read http://en.wikipedia.org/wiki/HTTP for more information.

To understand how HTTP works, I recommend that you install the tamperdata extension and liveHTTPheaders extensions for FireFox

http://tamperdata.mozdev.org/
http://livehttpheaders.mozdev.org/

Using these extensions, you can see what exactly is passed in the HTTP Header (using LiveHTTPHeaders extension) and what is passed in the HTTP Body (using TamperData extension).
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An HTTP request, is basically a stream of text.
That text is broken in to three sections.
1.) The request line
2.) The headers
3.) The body.

The header is a series of name/value pairs. The pairs are separated by a return/newline sequence. Name and value are separated by the colon character.
The end of the header section is marked of by two return/newline sequences together.
Everything after that is considered part of the body.

Here is an example POST request (caught with the packet sniffer, TcpFlow):


Line one is the request line.
Lines two through 13 are the headers.
Lines fourteen and fifteen mark the end of the headers
Line sixteen is the body.
The line numbers were added by me.

With GET requests there is no body.
[ September 06, 2006: Message edited by: Ben Souther ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lynette and I criss-crossed posts.
Here advice about getting a browser plugin that shows the HTTP headers is excellent.
It's a lot easier to learn HTTP if you can visually see the request and response information in real time as you post to your app.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!