Documentation

Std.Internal.Http.Data.Request

Request #

This module provides the Request type, which represents an HTTP request. It also defines ways to build a Request using functions that make it easier.

References:

The main parts of a request containing the HTTP method, version, and request target URI.

Reference: https://httpwg.org/specs/rfc9112.html#request.line

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

    HTTP request structure parameterized by body type.

    • line : Head

      The request line information (method, version, and request-target uri).

    • body : t

      The request body content of type t.

    • extensions : Extensions

      Optional dynamic metadata attached to the request.

    Instances For
      @[implicit_reducible]
      Instances For

        Builds an HTTP Request.

        • line : Head

          The request-line of an HTTP request.

        • extensions : Extensions

          Optional dynamic metadata attached to the request.

        Instances For
          @[implicit_reducible]

          Creates a new HTTP request builder with the default head (method: GET, version: HTTP/1.1, target: *).

          Instances For

            Sets the HTTP method for the request being built.

            Instances For

              Sets the HTTP version for the request being built.

              Instances For

                Sets the request target/URI for the request being built.

                Instances For

                  Sets the request target/URI for the request being built

                  Instances For

                    Sets the headers for the request being built

                    Instances For

                      Adds a single header to the request being built.

                      Instances For

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

                        Instances For

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

                          Instances For

                            Adds a header to the request being built only if the Option Header.Value is some.

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

                              Inserts a typed extension value into the request being built.

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

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

                                Instances For

                                  Creates a new HTTP GET Request with the specified URI.

                                  Instances For

                                    Creates a new HTTP POST Request builder with the specified URI.

                                    Instances For

                                      Creates a new HTTP PUT Request builder with the specified URI.

                                      Instances For

                                        Creates a new HTTP DELETE Request builder with the specified URI.

                                        Instances For

                                          Creates a new HTTP PATCH Request builder with the specified URI.

                                          Instances For

                                            Creates a new HTTP HEAD Request builder with the specified URI.

                                            Instances For

                                              Creates a new HTTP OPTIONS Request builder with the specified URI. Use Request.options (RequestTarget.asteriskForm) for server-wide OPTIONS.

                                              Instances For

                                                Creates a new HTTP CONNECT Request builder with the specified URI. Typically used with RequestTarget.authorityForm for tunneling.

                                                Instances For

                                                  Creates a new HTTP TRACE Request builder with the specified URI.

                                                  Instances For