Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

matlab.net.http.field.GenericField class

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

Construction

example

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.

Properties

expand all

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

Header value, specified as a string or character vector.

Methods

convert

Value of header field as MATLAB type.

MATLAB checks the matlab.net.http.field 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.

Attributes

Sealedtrue

Examples

expand all

A Content-Length header field must contain a number.

The following statement generates an error.

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

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

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

Introduced in R2016b

Was this topic helpful?