Main Content

matlab.net.http.field.GenericField Class

Namespace: matlab.net.http.field
Superclasses: matlab.net.http.HeaderField

HTTP header field with any name and value

Description

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, then MATLAB® creates a GenericField object.

Class Attributes

Sealed
true

For information on class attributes, see Class Attributes.

Creation

Description

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

example

Properties

expand all

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

Attributes:

GetAccess
public
SetAccess
public

Header value, specified as a string or character vector.

Attributes:

GetAccess
public
SetAccess
public
Dependent
true

Methods

expand all

Examples

collapse all

A Content-Length header field must contain a number.

The following statement generates an error.

field = matlab.net.http.field.ContentLengthField('abc');

For a character value, create a GenericField object.

field = matlab.net.http.field.GenericField('Content-Length','abc');

Version History

Introduced in R2016b