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
urlStringThe URL of the request.
-
Sets the URL of the request.
Declaration
Swift
public func url(_ urlString: String)Parameters
urlStringThe URL to be set.
-
Adds a parameter to the request.
Declaration
Swift
public func parameter(name: String, value: String)Parameters
nameThe name of the parameter.
valueThe value of the parameter.
-
Adds a header to the request.
Declaration
Swift
public func header(name: String, value: String)Parameters
nameThe name of the header.
valueThe value of the header.
-
Adds cookies to the request.
Declaration
Swift
public func cookies(cookies: [HTTPCookie])Parameters
cookiesThe cookies to be added.
-
Sets the body of the request.
Declaration
Swift
public func body(body: [String : Any])Parameters
bodyThe body to be set.
-
Sets the form of the request.
Declaration
Swift
public func form(formData: [String : String])Parameters
formDataThe 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
View on GitHub