Skip to main content

Content-Type

Learn Content-Type (Content Negotiation, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes Content-Type is a header that tells the receiver the media type of the body, such as application/json or multipart/form-data . It is sent on a request that has a body and on every response with a body. Request side : Spring picks the HttpMessageConverter that reads the body into your @RequestBody parameter based on it. Mapping : consumes on @PostMapping restricts accepted types; a wrong type gives 415 Unsupported Media Type .

More lessons in Content Negotiation