Main Content

changeFields

Class: matlab.net.http.HeaderField
Package: matlab.net.http

Change existing values in HeaderField array

Description

fields = changeFields(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.

Name matching is case-insensitive. However, if you specify a name that differs in case from the existing field name, then the field name changes to the specified name. This usage does not change the class of an existing field.

This method throws an error when:

  • All the specified fields are not already in the header.

  • There is more than one field with the specified name.

fields = changeFields(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.

Introduced in R2018a