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

Setting HTTP Specific Properties

func addValue(String, forHTTPHeaderField: String)

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

var allHTTPHeaderFields: [String : String]?

The receiver's header fields.

var httpBody: Data?

The request body of the receiver.

var httpBodyStream: InputStream?

The request body as an input stream.

var httpMethod: String

The receiver’s HTTP request method.

var httpShouldHandleCookies: Bool

A boolean value that indicates whether the receiver should use the default cookie handling for the request.

var httpShouldUsePipelining: Bool

A boolean value that indicates whether the request can continue transmitting data before receiving a response from an earlier transmission.