Response
public protocol Response
Represents an HTTP response.
-
The original request that produced this response.
Declaration
Swift
var data: Data { get } -
body()AsynchronousReturns the body of the response.
Declaration
Swift
func body() async -> StringReturn Value
The body as a String.
-
Returns the HTTP status code.
Declaration
Swift
func status() -> IntReturn Value
The status code as an Int.
-
Returns the cookies included in the response.
Declaration
Swift
func getCookies() -> [HTTPCookie]Return Value
A
Cookiescontainer. -
Returns the value of a header.
Declaration
Swift
func header(name: String) -> String?Parameters
nameThe name of the header.
Return Value
The header value, or
nilif not present. -
json()Default implementationReturns the body of the response as a JSON object.
Default Implementation
Returns the body of the response as a JSON object.
Declaration
Swift
func json() throws -> [String : Any]Return Value
The body of the response as a JSON object.
View on GitHub