This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page. class


HTTP Content-Type header field


A ContentTypeField object is an HTTP header field in a request or response message. The field contains a single media type specification indicating the type of content in the body of the message.

In a request message, a Content-Type field determines how data specified in the MessageBody.Data property is converted. For information on this conversion, see HTTP Data Type Conversion. If a request message contains a nonempty body, but does not contain a Content-Type field, then MATLAB® creates a Content-Type field based on the data type.


obj = creates a Content-Type header field with the Value property set to value.


expand all

Header field name, specified as 'Content-Type'.

Media type, specified as a object or a string acceptable to the MediaType constructor. Value cannot contain a quality ('q') parameter.

Example: 'text/html;charset=utf-8'



Return Value of ContentTypeField as MediaType object



Introduced in R2016b

Was this topic helpful?