Main Content



Set value of media type parameter


newType = setParameter(mediaType,name,value)


newType = setParameter(mediaType,name,value) returns a copy of the specified mediaType parameter with the parameter name set to value, creating one if it does not exist. Parameter name matching is case-insensitive. If a parameter exists with the same name, but different case, the case is changed to the specified name. If more than one match is found, only the last value is set.

A new parameter is added to the end of the list of parameters. If a q parameter exists in the list, the new parameter is treated as part of the accept-params rather than the media-type.

Input Arguments

expand all

Media type, specified as a object.

Parameter name, specified as a string.

Parameter value, specified as a scalar string, character vector, or any type supporting the string method. The resulting string must not be empty.

If value is empty or an empty string, parameter name is removed.

There is no validation of value.

Output Arguments

expand all

Updated media type, returned as a object.

See Also

Introduced in R2016b