HTTPResponseWriter
public protocol HTTPResponseWriter : class
                HTTPResponseWriter provides functions to create an HTTP response
- 
                  
                  
Writer function to create the headers for an HTTP response
Declaration
Swift
func writeHeader(status: HTTPResponseStatus, headers: HTTPHeaders, completion: @escaping (Result) -> Void)Parameters
statusThe status code to include in the HTTP response
headersThe HTTP headers to include in the HTTP response
completionClosure that is called when the HTTP headers have been written to the HTTP respose
 - 
                  
                  
Writer function to write a trailer header as part of the HTTP response
Declaration
Swift
func writeTrailer(_ trailers: HTTPHeaders, completion: @escaping (Result) -> Void)Parameters
trailersThe trailers to write as part of the HTTP response
completionClosure that is called when the trailers has been written to the HTTP response This is not currently implemented
 - 
                  
                  
Writer function to write data to the body of the HTTP response
Declaration
Swift
func writeBody(_ data: UnsafeHTTPResponseBody, completion: @escaping (Result) -> Void)Parameters
dataThe data to write as part of the HTTP response
completionClosure that is called when the data has been written to the HTTP response
 - 
                  
                  
Writer function to complete the HTTP response
Declaration
Swift
func done(completion: @escaping (Result) -> Void)Parameters
completionClosure that is called when the HTTP response has been completed
 - 
                  
                  
abort: Abort the HTTP response
Declaration
Swift
func abort() 
- 
                  
writeHeader(status:headers:)Extension methodConvenience function to write the headers for an HTTP response without a completion handler
Declaration
Swift
public func writeHeader(status: HTTPResponseStatus, headers: HTTPHeaders) - 
                  
writeHeader(status:)Extension methodConvenience function to write a HTTP response with no headers or completion handler
Declaration
Swift
public func writeHeader(status: HTTPResponseStatus) - 
                  
writeTrailer(_:)Extension methodConvenience function to write a trailer header as part of the HTTP response without a completion handler
Declaration
Swift
public func writeTrailer(_ trailers: HTTPHeaders) - 
                  
writeBody(_:)Extension methodConvenience function for writing
datato the body of the HTTP response without a completion handler.See
writeBody(_:completion:)Declaration
Swift
public func writeBody(_ data: UnsafeHTTPResponseBody) - 
                  
done()Extension methodConvenience function to complete the HTTP response without a completion handler.
See
done(completion:)Declaration
Swift
public func done() 
            View on GitHub
          
      HTTPResponseWriter Protocol Reference