matlab.net.http.field.GenericField - HTTP header field with any name and value - MATLAB (original) (raw)

Main Content

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 givenName 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.

Creation

Description

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

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

convert Value property of header field as MATLAB type.MATLAB checks the matlab.net.http.field namespace for a class with the GenericField.Name property. If there is a class for this field, then convert invokes theconvert method of that class.If the conversion fails or if no class supports this Name property, thenconvert throws an exception.

These methods specialize standard MATLAB operators and functions for objects in this class.

isequal true if two header field arrays are the same size and corresponding elements are equal, as described by eq method
string Array of header fields as string, as it appears in a message. Inserts newline characters between fields but not at the end of all fields.
char Array of header fields as character vector, as described bystring method

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