DEV Community

Salman Asu
Salman Asu

Posted on

2 2 2 2 2

HTTP Headers in API

http header are the field in http api request and response.

it is like setting up the address from and to in sending envelop to postman.

similarly http header are doing so.
*simple request header *

Image description

response header for same request

Image description

** some of build in header are **

  • host
  • path
  • content-type and many other refer doc

_u can add own custom header. _
like req.setHeader("X-myname","sallbro");
it is best practise to add X before name of header to identify it is custom header.

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay