Request
@objc public class Request: NSObject, IRequest
A Request object represents a network request.
-
The URL of the request.
Declaration
Swift
public var url: URL? = nil -
The HTTP method of the request.
Declaration
Swift
public var type: HTTPMethod = .get -
The body JSON object for the request.
Declaration
Swift
public var body: [String : AnyObject] = [:] -
The raw body data for the request. Converted to Data by serializing the
bodyobject.Declaration
Swift
public var rawBody: Data? -
The HTTP header fields for the request.
Declaration
Swift
public var headers: [String: String] = [:] -
Initializes a
Requestobject using the shared network manager instance.- paramter type: The HTTP method type for the request.
- paramter url: The URL for the request.
- paramter body: The JSON body data for the request.
Declaration
Swift
public convenience init(type: HTTPMethod, url: URL, body: [String: AnyObject]) -
Initializes a
Requestobject using the given network manager.- paramter type: The HTTP method type for the request.
- paramter url: The URL for the request.
- paramter body: The JSON body data for the request.
- paramter manager: The netwrok manager the request will use.
Declaration
Swift
public init(type: HTTPMethod, url: URL, body: [String: AnyObject], manager: INetworkManager) -
Sends the request by passing it on to the network manager.
Declaration
Swift
public func send() -> Promise<Response>Return Value
A promise that will be resolved when the request is completed.
Request Class Reference