Structure
HTTPResponse
An HTTP response structure for static file serving.
struct HTTPResponse
Overview
This type encapsulates an HTTP response head (status code and headers) along with an optional response body. All instances are Sendable, making them safe to pass across concurrency boundaries.
Overview
HTTPResponse provides factory methods for common HTTP status codes, making it easy to construct appropriate responses for various scenarios encountered during static file serving.
Topics
Creating Success Responses
?
ok(body:contentType:includeBody:)
Creates a 200 OK response with file content.
Creating Error Responses
?
badRequest
400 Bad Request response.
?
forbidden
403 Forbidden response.
?
notFound
404 Not Found response.
?
methodNotAllowed
405 Method Not Allowed response.
?
internalServerError
500 Internal Server Error response.