Accept Header Vs Content-Type Header

Often developers get confused between Accept header and Content-type header because both are used to specify Media type.
The difference lies between entity for which they represent Media type and nature of indication.
Lets dive little in it -

Accept Header

  • It is request type HTTP Header means only an HTTP request can have this header.

Content-Type

  • This header can be present in both Http Request and Http Response.

Conclusion

Accept header tells server, it would like to receive data in specified media type.

Content-type actually define media type of the content(request data in case of request header and response content in case of response header)

Fertile minded Web Application Developer . Love to explore JavaScript,Angular,Java and looking to increase work productivity. Developer @ Xoriant Solutions