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 header field with any name and value


Use a GenericField header field for testing or to work around a built-in restriction that might not be appropriate for your application. The HeaderField class and its subclasses validate the Value property for the given Name property. To override a Value that might otherwise be rejected, create a GenericField header field.

If a header field in a response message contains a value that is not valid for the field name, MATLAB® creates a GenericField object.



obj =,value) creates an HTTP header field with the Name property set to name and the Value property set to value.


expand all

Header field name, specified as a string or character vector.

Header value, specified as a string or character vector.


getParameterReturn value of parameter in field
removeParameterRemove parameter from field
setParameterSet value of parameter in field

Inherited Methods


Value of header field as MATLAB type.

MATLAB checks the package for a class with the GenericField.Name property. If there is a class for this field, then convert invokes the convert method of that class.

If the conversion fails or if no class supports this Name property, then convert throws an exception.




collapse all

A Content-Length header field must contain a number.

The following statement generates an error.

field ='abc');

If instead you need a character value, create a GenericField object.

field ='Content-Length','abc');

Introduced in R2016b

Was this topic helpful?