RequestWithPayload
public struct RequestWithPayload<HTTPBody> where HTTPBody : Encodable
extension RequestWithPayload: URLRequestProvider
Request structure with a encodable http body.
Used for POST and DELETE requests.
-
The url provider
Declaration
Swift
public let url: URLProvider -
HTTP Method for this request
Declaration
Swift
public let method: HTTPMethod -
Headers to be added for this request
Declaration
Swift
public let headers: Headers? -
The encodable parameters that needs to be sent with the request body
Declaration
Swift
public let httpBody: HTTPBody? -
Initializer to construct a request object
Declaration
Swift
public init(url: URLProvider, method: HTTPMethod, headers: Headers? = nil, httpBody: HTTPBody? = nil)Parameters
urlThe url provider
methodHTTP Method for this request
headersHeaders to be added for this request
httpBodyThe encodable parameters that needs to be sent with the request body
-
Declaration
Swift
public func urlRequest() throws -> URLRequest