Tuesday 20 May 2014

Explain difference between get and post method.

  • Visibility - GET request is sent via the URL string which is visible whereas POST request cant be seen as it is encapsulated in the body of the HTTP request 
  • Length – there is limitation of length for GET request as it goes through URL and its character length cant be more than 255 but in POST request no such limitation.
  • Performance –As no time is spend on encapsulation in GET request so it is comparatively faster and relatively simpler. In addition, the maximum length restriction facilitates better optimization of GET implementation.
  • Type of Data - GET request can carry only text data as we know URL only contain text data on the other hand post request can carry both text as well as binary
  • Caching/Bookmarking – as we know now that GET request is nothing but a URL hence it can be cached as well as bookmarked. No such options are available with a POST request.
  • FORM Default - GET is the default method of the HTML FORM element. To submit a FORM using POST method, we need to specify the method attribute and give it the value "POST".
  • Data Set - GET requests are restricted to use ASCII characters only whereas no such restrictions are in POST requests

No comments:

Post a Comment