Hearken Documentation Beta

Structure HTTPResponse

public struct HTTPResponse: Equatable

A simplified model for HTTP responses.

Conforms To

Equatable

Initializers

init(status:​headers:​body:​)

public init(status: HTTPResponseStatus, headers: HTTPHeaders = [], body: HTTPBody? = nil)

Creates an instance of HTTPResponse.

Parameters

status HTTPResponse​Status
  • status: HTTP response status eg. 200 OK.
headers HTTPHeaders
  • headers: HTTP response headers eg. Content-Type: application/json. Defaults to empty.
body HTTPBody?
  • body: HTTP response body. Defaults to nil.

Properties

status

let status: HTTPResponseStatus

HTTP response status eg. 200 OK.

headers

let headers: HTTPHeaders

HTTP response headers eg. Content-Type: application/json.

body

let body: HTTPBody?

HTTP response body.