Create a simple response from a status, headers, and body ByteArray. $$\text{responseLBS} : \text{Status} \to \text{ResponseHeaders} \to \text{String} \to \text{Response}$$ @since 0.3.0
Equations
- Network.Wai.responseLBS status headers body = Network.Wai.Response.responseBuilder status headers body.toUTF8
Instances For
Create a file response. @since 2.0.0
Equations
- Network.Wai.responseFile' status headers path part = Network.Wai.Response.responseFile status headers path part
Instances For
Create a streaming response. @since 3.0.0
Equations
- Network.Wai.responseStream' status headers body = Network.Wai.Response.responseStream status headers body
Instances For
Get the next chunk of the request body. Returns empty ByteArray when
the body is fully consumed. Preferred over direct requestBody access.
$$\text{getRequestBodyChunk} : \text{Request} \to \text{IO}(\text{ByteArray})$$
@since 3.2.2
Equations
Instances For
Set the request body chunks IO action on a request. The supplied IO action should return the next chunk each time it is called and empty ByteArray when fully consumed. $$\text{setRequestBodyChunks} : \text{IO}(\text{ByteArray}) \to \text{Request} \to \text{Request}$$ @since 3.2.4
Equations
- One or more equations did not get rendered due to their size.
Instances For
Get a header value from a request by name.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Read the entire request body strictly into memory. Returns all chunks concatenated as a single ByteArray.
Warning: This consumes the request body. Future calls return empty.
Consider using getRequestBodyChunk for streaming when possible.
$$\text{strictRequestBody} : \text{Request} \to \text{IO}(\text{ByteArray})$$
@since 3.0.1
Equations
- One or more equations did not get rendered due to their size.
Instances For
Synonym for strictRequestBody.
Name signals the non-idempotent (consuming) nature.
@since 3.2.3
Instances For
A default, blank request. @since 2.0.0
Equations
- One or more equations did not get rendered due to their size.
Instances For
Apply the provided function to the request header list. $$\text{mapRequestHeaders} : (H \to H) \to \text{Request} \to \text{Request}$$ @since 3.2.4
Equations
- One or more equations did not get rendered due to their size.
Instances For
The identity middleware (does nothing).
Equations
Instances For
Compose two middlewares. $$\text{composeMiddleware}(f, g) = f \circ g$$
Equations
- Network.Wai.composeMiddleware f g = f ∘ g
Instances For
Add a header to the response.
Equations
- Network.Wai.addHeader name val resp = Network.Wai.Response.mapResponseHeaders (fun (x : Network.HTTP.Types.ResponseHeaders) => (name, val) :: x) resp
Instances For
Apply a function that modifies a request as a Middleware. $$\text{modifyRequest} : (\text{Request} \to \text{Request}) \to \text{Middleware}$$ @since 3.2.4
Equations
- Network.Wai.modifyRequest f app req respond = app (f req) respond
Instances For
Apply a function that modifies a response as a Middleware. $$\text{modifyResponse} : (\text{Response} \to \text{Response}) \to \text{Middleware}$$ @since 3.0.3.0
Equations
- Network.Wai.modifyResponse f app req respond = app req (respond ∘ f)
Instances For
Conditionally apply a Middleware based on a request predicate. $$\text{ifRequest}(p, m) = \begin{cases} m & \text{if } p(\text{req}) \\ \text{id} & \text{otherwise} \end{cases}$$ @since 3.0.3.0
Equations
Instances For
Identity middleware is left identity for composition. $$\text{id} \circ m = m$$
Identity middleware is right identity for composition. $$m \circ \text{id} = m$$
modifyRequest id is the identity middleware.
modifyResponse id is the identity middleware.
ifRequest (fun _ => false) always passes through.
$$\text{ifRequest}(\bot, m) = \text{id}$$