Junior — Middle
Can you give examples of different types of headers used in HTTP requests?
sobes.tech AI
Answer from AI
Various headers are used in HTTP requests to pass additional information about the request or client. Here are some common examples:
Host— specifies the domain name of the server and port to which the request is directed.User-Agent— information about the client application (browser, version, etc.).Accept— content types that the client is willing to accept (e.g.,text/html,application/json).Authorization— credentials for authentication (e.g., token or username/password).Content-Type— the media type of the request body (e.g.,application/jsonwhen sending JSON).Cookie— cookies sent by the client to the server.Referer— URL of the page from which the request was made.
These headers help the server process the request correctly and generate an appropriate response.