struct PageResponse
Swift
struct PageResponse
A handler's answer for a PageRequest.
nprpc_swift/Sources/NPRPC/PageHandler.swift:73
Constructors
init(status: Int = 200, headers: [String : String] = [:], body: [UInt8])
A response with a raw body; see init(html:status:headers:) for text.
nprpc_swift/Sources/NPRPC/PageHandler.swift:83
init(html: String, status: Int = 200, headers: [String : String] = [:])
An HTML response.
nprpc_swift/Sources/NPRPC/PageHandler.swift:92
Properties
var body: [UInt8]
The response body.
nprpc_swift/Sources/NPRPC/PageHandler.swift:80
var headers: [String : String]
Response headers. content-type defaults to text/html; charset=utf-8
when left unset.
nprpc_swift/Sources/NPRPC/PageHandler.swift:78
var status: Int
HTTP status code.
nprpc_swift/Sources/NPRPC/PageHandler.swift:75
Methods
static func redirect(to location: String, status: Int = 303) -> PageResponse
A redirect, defaulting to 303 See Other — the right status after a POST, since it makes the browser follow up with a GET.
nprpc_swift/Sources/NPRPC/PageHandler.swift:100