Documentation

Std.Internal.Http.Data.Response

Response #

This module provides the Response type, which represents an HTTP response. It also defines builder functions for constructing responses and selecting common HTTP status codes.

The main parts of a response.

  • status : Status

    The HTTP status for the response.

  • version : Version

    The HTTP protocol version used in the response, e.g. HTTP/1.1.

  • headers : Headers

    The set of response headers, providing metadata such as Content-Type, Content-Length, and caching directives.

Instances For
    @[implicit_reducible]
    structure Std.Http.Response (t : Type) :

    HTTP response structure parameterized by body type.

    • line : Head

      The response status-line information.

    • body : t

      The content of the response.

    • extensions : Extensions

      Optional dynamic metadata attached to the response.

    Instances For
      @[implicit_reducible]

      Builds an HTTP Response.

      • line : Head

        The response status-line information.

      • extensions : Extensions

        Optional dynamic metadata attached to the response.

      Instances For

        Creates a new HTTP Response builder with default head (status: 200 OK, version: HTTP/1.1).

        Instances For

          Creates a new HTTP Response builder with default head (status: 200 OK, version: HTTP/1.1).

          Instances For

            Sets the HTTP status code for the response being built.

            Instances For

              Sets the headers for the response being built.

              Instances For

                Adds a single header to the response being built.

                Instances For

                  Adds a single header to the response being built, panics if the header is invalid.

                  Instances For

                    Adds a single header to the response being built. Returns none if the header name or value is invalid.

                    Instances For
                      def Std.Http.Response.Builder.extension {α : Type u_1} (builder : Builder) [TypeName α] (data : α) :

                      Inserts a typed extension value into the response being built.

                      Instances For
                        def Std.Http.Response.Builder.body {t : Type} (builder : Builder) (body : t) :

                        Builds and returns the final HTTP Response with the specified body.

                        Instances For

                          Builds and returns the final HTTP Response with an empty body ({}). Requires an EmptyCollection instance for the response body type.

                          Instances For

                            Creates a new HTTP Response builder with the 200 status code.

                            Instances For

                              Creates a new HTTP Response builder with the provided status.

                              Instances For

                                Creates a new HTTP Response builder with the 404 status code.

                                Instances For

                                  Creates a new HTTP Response builder with the 500 status code.

                                  Instances For

                                    Creates a new HTTP Response builder with the 400 status code.

                                    Instances For

                                      Creates a new HTTP Response builder with the 201 status code.

                                      Instances For

                                        Creates a new HTTP Response builder with the 202 status code.

                                        Instances For

                                          Creates a new HTTP Response builder with the 401 status code.

                                          Instances For

                                            Creates a new HTTP Response builder with the 403 status code.

                                            Instances For

                                              Creates a new HTTP Response builder with the 409 status code.

                                              Instances For

                                                Creates a new HTTP Response builder with the 503 status code.

                                                Instances For