Main Content

replaceFields

Class:matlab.net.http.HeaderField
Package: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 aschangeFields, but if a field does not exist, thenreplaceFieldsadds 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 infields. This syntax might change the class of an existing field if the field name is a case-insensitive match to a name infields.

Input Arguments

expand all

Header fields, specified as an array ofmatlab.net.http.HeaderFieldobjects.

Header field name, specified as a string.

Header field value, specified as a string or any type valid forfName. To use the default value for the field, setfValueto''. 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 morematlab.net.http.HeaderFieldobjects.

Version History

Introduced in R2018a

See Also