Package: matlab.net.http
Header field of HTTP message
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
package. To see a list of supported subclasses,
call the HeaderField.displaySubclasses
method.
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.
The HeaderField
constructor creates fields of class
HeaderField
. To create a field of a class defined in the
matlab.net.http.field
package, use the subclass constructor instead.
For a list of subclasses, call the HeaderField.displaySubclasses
method.
For example, the matlab.net.http.field.DateField
subclass creates a
Date header field. If you use the HeaderField
class to create a Date field,
the DateField
class interprets and enforces the value, even though
HeaderField
is not an instance of DateField
. Likewise, if
you convert the field value to a MATLAB
datetime
value, the DateField.convert
method is
used.
If the HeaderField
constructor rejects the Name
and Value
arguments, use the GenericField
class
constructor instead.