• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why get why noy post?

 
Manjunath Chumbalakar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi,

I always wonder why we have to go for get why not all the times post because post is more secure....?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post isn't really more secure, it just looks that way.
 
Reehan Lalkhanwar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For simple request, like an ajax call, a get would be much simpler and easier.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
data contained in the HTTP header for POST requests do not get logged or cached, but regular data on the URL still can be.
GET should be used when (for example) the request should be able to be bookmarked or repeatable.
POST should be used for requests that send data that changes some state on the server or when binary data or over (about) 2000 characters of data needs to be sent.
 
Manjunath Chumbalakar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks David,

I got your point. But is it true that get method is more fast(in terms of execution speed) than that of post.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope. Why would that be so? In their simplest form they result in almost the same HTTP request being sent to the server (POST is one character longer than GET) could possibly call the same method and have the same size HTTP response. There is nothing specific about either GET or POST that makes one take longer or shorter than the other.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65217
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When it comes to POST vs GET, you should use GET when the intention is to fetch ("get") data, and POST when the intention is to post data.

And to re-emphasize two misconceptions already addressed but that need repeating:
  • POST is no more secure than GET.
  • Neither has better performance than the other.

  • Use the one that makes the most sense for the operation.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic