Home/Guides/Content parser guide: parse and validate Content-Type header

Content parser guide: parse and validate Content-Type header

Content-Type parsing errors break API and webhook integrations. Learn how to validate media type, charset, and boundary parameters so servers parse requests correctly.

Common causes

  • Wrong media type, for example text/plain instead of application/json.
  • Missing charset or malformed parameters in the header.
  • Multipart requests without a valid boundary value.

How to fix

  • Parse the header and verify type/subtype plus parameters.
  • Match Content-Type to the actual request body format.
  • Reject unsupported types early and return clear 415 responses.