nincs12
nincs12

Reputation: 15

Why both POST and GET are called "requests" even though Post sends data, instead of receiving?

Question quite self-explanatory. I want to find out why both of these methods are called requests. Because they request info from the server? But only one of them actually "gets" data, one of them sends data.

Upvotes: 1

Views: 57

Answers (3)

deceze
deceze

Reputation: 522135

The response to a POST request also (usually) contains data…

HTTP is called a request-response protocol. A client makes a request of a server ("server, please do something for me") and the server responds ("here's the answer to your request of me"). It doesn't matter which way data is being transported, usually the data sending is bi-directional anyway.

There are also more HTTP verbs than just GET and POST, e.g. HEAD, PUT, DELETE and OPTIONS to name a few standard ones. The "request-response" naming doesn't change based on the verb used within the request.

This "request-response" mechanism highlights the strict and limited way in which clients and servers can communicate. The server will never ever contact the client and send any sort of command to it. It is always the client which initiates the communication with a request it makes of the server, and all the server can do with it is respond to it.

Upvotes: 1

David Glickman
David Glickman

Reputation: 790

You cannot send data to the server with HTTP. It is only a request protocol where the client requests and the server responds.
When you send data, you are really sending a request with the data you are sending attached. "Please can I have x and here's the post data".

Upvotes: 0

domsson
domsson

Reputation: 4681

Simple: In the case of the user sending data, think of it as a request to process said data.

Whether this results in a refreshed page that somehow incorporates what you sent via GET/POST, just does something in the background or completely ignores your request is a different matter entirely.

Upvotes: 0

Related Questions