Documentation

Std.Http.Data.Headers

Headers #

This module defines the Headers type, which represents a collection of HTTP header name-value pairs.

Reference: https://www.rfc-editor.org/rfc/rfc9110.html#section-5

A structure for managing HTTP headers as key-value pairs.

Reference: https://www.rfc-editor.org/rfc/rfc9110.html#section-5

Instances For
    @[instance_reducible]
    Equations
    @[inline]
    def Std.Http.Headers.get (headers : Headers) (name : Header.Name) (h : name headers) :

    Retrieves the first Header.Value for the given key.

    Equations
    Instances For
      @[inline]
      def Std.Http.Headers.getAll (headers : Headers) (name : Header.Name) (h : name headers) :

      Retrieves all Header.Value entries for the given key.

      Equations
      Instances For
        @[inline]

        Like getAll, but returns none instead of requiring a membership proof. Returns none if the header is absent.

        Equations
        Instances For
          @[inline]

          Retrieves the first Header.Value for the given key. Returns none if the header is absent.

          Equations
          Instances For
            @[inline]
            def Std.Http.Headers.hasEntry (headers : Headers) (name : Header.Name) (value : Header.Value) :

            Checks if the entry is present in the Headers.

            Equations
            Instances For
              @[inline]

              Retrieves the last header value for the given key. Returns none if the header is absent.

              Equations
              Instances For
                @[inline]

                Like get?, but returns a default value if absent.

                Equations
                Instances For
                  @[inline]

                  Like get?, but panics if absent.

                  Equations
                  Instances For
                    @[inline]

                    Inserts a new key-value pair into the headers.

                    Equations
                    Instances For
                      @[inline]
                      def Std.Http.Headers.insert! (headers : Headers) (name value : String) :

                      Adds a header from string name and value, panicking if either is invalid.

                      Equations
                      Instances For
                        @[inline]
                        def Std.Http.Headers.insert? (headers : Headers) (name value : String) :

                        Adds a header from string name and value. Returns none if either the header name or value is invalid.

                        Equations
                        Instances For
                          @[inline]

                          Inserts a new key with an array of values.

                          Equations
                          Instances For

                            Creates empty headers.

                            Equations
                            Instances For

                              Creates headers from a list of key-value pairs.

                              Equations
                              Instances For
                                @[inline]

                                Checks if a header with the given name exists.

                                Equations
                                Instances For
                                  @[inline]

                                  Removes a header with the given name.

                                  Equations
                                  Instances For
                                    @[inline]

                                    Removes all headers whose names appear in names. Names not present are ignored. Cheaper than chaining erase calls because IndexMultiMap.eraseMany rebuilds the index once in total rather than once per erase call.

                                    Equations
                                    Instances For
                                      @[inline]

                                      Gets the number of headers.

                                      Equations
                                      Instances For
                                        @[inline]

                                        Checks if the headers are empty.

                                        Equations
                                        Instances For
                                          def Std.Http.Headers.merge (headers1 headers2 : Headers) :

                                          Merges two headers, accumulating values for duplicate keys from both.

                                          Equations
                                          Instances For

                                            Converts the headers to a list of key-value pairs (flattened). Each header with multiple values produces multiple pairs.

                                            Equations
                                            Instances For

                                              Converts the headers to an array of key-value pairs (flattened). Each header with multiple values produces multiple pairs.

                                              Equations
                                              Instances For
                                                def Std.Http.Headers.fold {α : Type u_1} (headers : Headers) (init : α) (f : αHeader.NameHeader.Valueα) :
                                                α

                                                Folds over all key-value pairs in the headers.

                                                Equations
                                                Instances For

                                                  Maps a function over all header values, producing new headers.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For

                                                    Filters and maps over header key-value pairs. Returns only the pairs for which the function returns some.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For

                                                      Filters header key-value pairs, keeping only those that satisfy the predicate.

                                                      Equations
                                                      Instances For

                                                        Updates all the values of a header if it exists.

                                                        Equations
                                                        Instances For
                                                          @[inline]

                                                          Replaces the last value for the given header name. If the header is absent, returns the headers unchanged.

                                                          Equations
                                                          Instances For
                                                            @[instance_reducible]
                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            @[instance_reducible]
                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            @[instance_reducible]
                                                            Equations
                                                            • One or more equations did not get rendered due to their size.