Request
public class Request : @unchecked Sendable
Class for a Request. A Request represents a request to be sent over the network.
-
The URL request.
Declaration
Swift
public private(set) var urlRequest: URLRequest { get }
-
Initializes a Request with a URL.
Declaration
Swift
public init(urlString: String = "https://")
Parameters
urlString
The URL of the request.
-
Sets the URL of the request.
Declaration
Swift
public func url(_ urlString: String)
Parameters
urlString
The URL to be set.
-
Adds a parameter to the request.
Declaration
Swift
public func parameter(name: String, value: String)
Parameters
name
The name of the parameter.
value
The value of the parameter.
-
Adds a header to the request.
Declaration
Swift
public func header(name: String, value: String)
Parameters
name
The name of the header.
value
The value of the header.
-
Adds cookies to the request.
Declaration
Swift
public func cookies(cookies: [HTTPCookie])
Parameters
cookies
The cookies to be added.
-
Sets the body of the request.
Declaration
Swift
public func body(body: [String : Any])
Parameters
body
The body to be set.
-
Sets the form of the request.
Declaration
Swift
public func form(formData: [String : String])
Parameters
formData
The form to be set.
-
Represents various content types used in HTTP requests.
See moreDeclaration
Swift
public enum ContentType : String
-
Represents HTTP methods used in network requests.
See moreDeclaration
Swift
public enum HTTPMethod : String
-
Represents various constants used in network requests.
See moreDeclaration
Swift
public enum Constants