hi
can someone explain the use of headers? why they are used and when to use them?
Thanks
Header | Purpose |
Content-Type | Tells the server what kind of data is being sent (application/json, text/html, etc.) |
Authorization | Used for login credentials (e.g., Bearer token) |
User-Agent | Identifies the client (e.g., browser or app) |
Accept | What formats the client can accept |
Cache-Control | Directs how caching should be handled |
Set-Cookie | Sends cookies from the server to the client |
Host | Specifies the domain being requested |