matlab.net.http.HeaderField Class
Namespace: matlab.net.http
Header field of HTTP message
Description
Use the HeaderField
class to implement a header field for an HTTP message.
The class provides conversions between strings in the header and MATLAB® objects, arrays, and structures. Although you can set the
HeaderField
properties to arbitrary values, HTTP header fields have
constraints on the allowed characters.
The Name
property defines the header field type. MATLAB provides subclasses for commonly used fields in the
matlab.net.http.field
namespace. To see a list of supported subclasses,
call the HeaderField.displaySubclasses
method.
Creation
Description
obj = matlab.net.http.HeaderField(name,value)
creates a header
field with the Name
property set to
name
and the Value
property set to
value
. Either argument can be an empty double, []
.
You can specify several argument pairs in any order as
name1,value1,...,nameN,valueN
. If the last value
argument is missing, then HeaderField
treats it as empty.
Properties
Methods
Examples
Tips
The
HeaderField
constructor creates fields of classHeaderField
. To create a field of a class defined in thematlab.net.http.field
namespace, use the subclass constructor instead. For a list of subclasses, call theHeaderField.displaySubclasses
method.For example, the
matlab.net.http.field.DateField
subclass creates a Date header field. If you use theHeaderField
class to create a Date field, theDateField
class interprets and enforces the value, even thoughHeaderField
is not an instance ofDateField
. Likewise, if you convert the field value to a MATLABdatetime
value, theDateField.convert
method is used.If the
HeaderField
constructor rejects theName
andValue
arguments, use theGenericField
class constructor instead.
Version History
Introduced in R2016b