Main Content

replaceFields

Class: matlab.net.http.HeaderField
Namespace: matlab.net.http

Change values in or add fields to array of HeaderFields

Description

fields = replaceFields(fields,FieldName1,FieldValue1,...,FieldNameN,FieldValueN) changes the existing fields in each header field with the specified names to the indicated values and returns the updated array. This method is the same as changeFields, but if a field does not exist, then replaceFields adds it to the end of fields.

fields = replaceFields(fields,newFields) changes the existing fields in each header field to the names, values, and types specified in fields. This syntax might change the class of an existing field if the field name is a case-insensitive match to a name in fields.

Input Arguments

expand all

Header fields, specified as an array of matlab.net.http.HeaderField objects.

Header field name, specified as a string.

Header field value, specified as a string or any type valid for fName. To use the default value for the field, set fValue to ''. If the last value is missing, then it is the same as specifying [].

Fields to add, specified as a vector or comma-separated list of one or more matlab.net.http.HeaderField objects.

Version History

Introduced in R2018a

See Also