HTTP GET vs POST (HTTP verbs)
HTTP Get vs Post or GET and POST are the two major types of HTTP Verbs one can make to a server. A lot of people often don’t know the difference between them and end up choosing the wrong one. This may lead to some serious performance issues at times or even leave security based vulnerabilities in your web app. Let us have a look at both GET and POST and see for ourselves which one should be used where.
What is GET
GET is a type of HTTP request that can be made to a web server to request data. Whenever you request data from a server, you might be asked to supply some additional parameters specifying exactly what you want. These parameters are often passed in the URL of the website. So with GET, you can order details of a person from a website by visiting a URL like sitename.com?username=rishabh, the username parameter is passed to the server from within the URL itself. So it’s like you visited that URL.
What is POST
The POST is another type of HTTP request that can be made to the server, the key difference from GET would be that parameters are not passed in the URL. So the browser cannot store them. Also, POST allows you to send binary data which is not possible in GET since GET uses URL to pass parameters and needless to say it is not possible to pass a binary object in the URL. Also, the post is a lot more secure and can pass more data to the server.
Which one to use where
I see a lot of young developers using just GET everywhere. This isn’t right, because GET requests are cached by the browser, so probably passing sensitive information including user credentials and other important info via Url in a get request may not be the smartest decision to make. You should try to use POST for most of the time, GET should only be used in places where you are requesting resources that can be loaded from cache.
I know there is a lot more to this topic but we probably won’t be able to cover it here, But I hope you guys get an idea of why its not safe to use GET requests everywhere. If you have any doubts feel free to drop it in the comments section everywhere and I’ll be there for you.