Open ClassFoundationNetworking5.9.0
NSMutableURLRequest
An NSMutableURLRequest
object represents a mutable URL load request in a manner independent of protocol and URL scheme.
class NSMutableURLRequest
This specialization of NSURLRequest
is provided to aid developers who may find it more convenient to mutate a single request object for a series of URL loads instead of creating an immutable NSURLRequest
for each load. This programming model is supported by the following contract stipulation between NSMutableURLRequest
and the URLSession
API: URLSession
makes a deep copy of each NSMutableURLRequest
object passed to it.
NSMutableURLRequest
is designed to be extended to support protocol-specific data by adding categories to access a property object provided in an interface targeted at protocol implementors.
Protocol implementors should direct their attention to the NSMutableURLRequestExtensibility
category on NSMutableURLRequest
for more information on how to provide extensions on NSMutableURLRequest
to support protocol-specific request information.
Clients of this API who wish to create NSMutableURLRequest
objects to load URL content should consult the protocol-specific NSMutableURLRequest
categories that are available. The NSMutableHTTPURLRequest
category on NSMutableURLRequest
is an example.
Superclasses
class NSURLRequest
An
NSURLRequest
object represents a URL load request in a manner independent of protocol and URL scheme.
Citizens in FoundationNetworking
Conformances
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol NSCoding
The
NSCoding
protocol declares the two methods that a class must implement so that instances of that class can be encoded and decoded. This capability provides the basis for archiving (where objects and other structures are stored on disk) and distribution (where objects are copied to different address spaces).protocol NSCopying
The
NSCopying
protocol declares a method for providing functional copies of an object. The exact meaning of “copy” can vary from class to class, but a copy must be a functionally independent object with values identical to the original at the time the copy was made.protocol NSMutableCopying
The
NSMutableCopying
protocol declares a method for providing mutable copies of an object. Only classes that define an “immutable vs. mutable” distinction should adopt this protocol. Classes that don’t define such a distinction should adoptNSCopying
instead.protocol NSObjectProtocol
The
NSObjectProtocol
groups methods that are fundamental to all Foundation objects.protocol NSSecureCoding
Conforming to the
NSSecureCoding
protocol indicates that an object handles encoding and decoding instances of itself in a manner that is robust against object substitution attacks.
Members
init?(coder: NSCoder
) convenience init(url: URL
) init(url: URL, cachePolicy: NSURLRequest.CachePolicy, timeoutInterval: TimeInterval
) var allHTTPHeaderFields: [String : String]?
var allowsCellularAccess: Bool
var cachePolicy: NSURLRequest.CachePolicy
var httpBody: Data?
var httpBodyStream: InputStream?
var httpMethod: String?
The HTTP request method of the receiver.
var httpShouldHandleCookies: Bool
var httpShouldUsePipelining: Bool
var mainDocumentURL: URL?
var networkServiceType: NSURLRequest.NetworkServiceType
var timeoutInterval: TimeInterval
var url: URL?
func addValue(String, forHTTPHeaderField: String
) Adds an HTTP header field in the current header dictionary.
func copy(with: NSZone?
) -> Any func setValue(String
?, forHTTPHeaderField: String) Sets the value of the given HTTP header field.