Instance Method

setValue(_:forHTTPHeaderField:)

Sets the specified HTTP header field.

Declaration

func setValue(_ value: String?, forHTTPHeaderField field: String)

Parameters

value

The new value for the header field. Any existing value for the field is replaced by the new value.

field

The name of the header field to set. In keeping with the HTTP RFC, HTTP header field names are case-insensitive.

Discussion

If the length of your upload body data can be determined automatically (for example, if you provide the body content with an NSData object), then the value of Content-Length is set for you.

See Also

Related Symbols

func addValue(String, forHTTPHeaderField: String)

Adds an HTTP header to the receiver’s HTTP header dictionary.

func value(forHTTPHeaderField: String)

Returns the value of the specified HTTP header field.