Documentation

Hale.WAI.Network.Wai

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
Instances For

    Create a file response. @since 2.0.0

    Equations
    Instances For

      Create a streaming response. @since 3.0.0

      Equations
      Instances For
        @[inline]

        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
                @[reducible, inline]

                Synonym for strictRequestBody. Name signals the non-idempotent (consuming) nature. @since 3.2.3

                Equations
                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
                        @[inline]

                        Compose two middlewares. $$\text{composeMiddleware}(f, g) = f \circ g$$

                        Equations
                        Instances For

                          Add a header to the response.

                          Equations
                          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
                            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
                              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$$

                                  theorem Network.Wai.ifRequest_false (middle : Middleware) :
                                  ifRequest (fun (x : Request) => false) middle = idMiddleware

                                  ifRequest (fun _ => false) always passes through. $$\text{ifRequest}(\bot, m) = \text{id}$$