This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

replaceFields

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

Change values in or add fields to array of HeaderFields

Syntax

fields = replaceFields(fields,FieldName1,FieldValue1,...,FieldNameN,FieldValueN)
fields = replaceFields(fields,newFields)

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.

See Also

Introduced in R2018a