What is "http-request"
Or request, in English, it is a request for a resource, the client wants something from the server, has similar structure to a response
Request example:
POST /contact_form.php HTTP/1.1
Host: developer.mozilla.org
Content-Length: 64
Content-Type: application/x-www-form-urlencoded
name=Joe%20User&request=Send%20me%20one%20of%20your%20catalogue
The first line of the request informs, in sequence:
Method: or method, in English, the basics are POST, GET, PUT and DELETE, equivalent to Create, Read, Update and Delete operations. For more information, look at the tag http-methods
URL: the path to which the request will be sent,
The HTTP version is usually 1.1 but there is already http2
From the second row are the headers, or headers, in English. It has the format Nome: Valor
, are useful information that can be used by the receiver to decide whether and how to treat that data, for example type of content (Content-Type
), authorization (Authorization
), among several others. For more information, look at the tag http-headers
A blank line, it splits the headers of the next and last part
The body, or body, in English, it is the content itself, can be in several formats (usually specified in the header). It usually contains data for searching, inserting, editing or deleting some server resource. It is not required and in some methods, can be ignored by the server when generating a response