Class

NSMutable​URLRequest

NSMutable​URLRequest is a subclass of NSURLRequest provided to aid developers who may find it more convenient to mutate a single request object for a series of URL load requests instead of creating an immutable NSURLRequest object for each load.

Overview

NSMutable​URLRequest, like NSURLRequest, is designed to be extended to support additional protocols by adding categories that provide accessor methods for your own protocol-specific properties. Those methods can get and set the actual values by calling the NSURLProtocol methods property(for​Key:​in:​) and set​Property(_:​for​Key:​in:​).

The NSURLSession, NSURLConnection, and NSURLDownload classes make a deep copy of each NSMutable​URLRequest object passed to their initializers and task creation methods.

Reserved HTTP Headers

The URL Loading System is designed to handle various aspects of the HTTP protocol for you. As a result, you should not modify the following headers using the add​Value(_:​for​HTTPHeader​Field:​) or set​Value(_:​for​HTTPHeader​Field:​) methods:

  • Authorization

  • Connection

  • Host

  • Proxy-Authenticate

  • Proxy-Authorization

  • WWW-Authenticate

Symbols

Setting Request Properties

var main​Document​URL:​ URL?

The main document URL for the receiver.

var timeout​Interval:​ Time​Interval

The receiver’s timeout interval, in seconds.

var url:​ URL?

The URL of the receiver

var allows​Cellular​Access:​ Bool

A Boolean value that indicates whether the connection can use the device’s cellular radio (if present). true by default

Setting HTTP Specific Properties

func add​Value(String, for​HTTPHeader​Field:​ String)

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

var http​Body:​ Data?

The request body of the receiver.

var http​Body​Stream:​ Input​Stream?

The request body as an input stream.

var http​Method:​ String

The receiver’s HTTP request method.

var http​Should​Handle​Cookies:​ Bool

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

var http​Should​Use​Pipelining:​ Bool

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

Relationships

Inherits From