Main Content

addFields

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

Add fields to HeaderField array

Description

fields = addFields(fields,newFields) adds newFields to the end of the HeaderField array fields and returns the updated array. addFields does not check for duplicate fields.

fields = addFields(msg,fName,fValue) adds field with name fName and value fValue.

fields = addFields(fields,fName1,fValue1,...,fNameN,fValueN) adds fields specified by fName, fValue pair arguments, in the order specified.

fields = addFields(fields,index,___) inserts fields at index and can include any of the input arguments in previous syntaxes.

Input Arguments

expand all

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

Fields to add, specified as a vector or comma-separated list of one or more 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 [].

Location in header field array, specified as an integer. If index is greater than the length of the header or index is 0, the method adds fields to the end. If index is negative, the method counts from the end of the header.

Version History

Introduced in R2018a