ResponsePatch

public final class ResponsePatch

Patches Response via HBResponse.apply(patch:)

Allow you to patch the response generated by your route handler via the HBRequest supplied. If your handler is only returning the payload you can edit the status and headers via request.response eg.

func myHandler(_ request: HBRequest) -> String {
    request.response.status = .accepted
    return "hello"
}
  • patch status of reponse

    Declaration

    Swift

    public var status: HTTPResponseStatus?
  • headers to add to response

    Declaration

    Swift

    public var headers: HTTPHeadersPatch