Instance Method


Sets the specified HTTP header field.


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



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


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


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.