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]
    @[instance_reducible]
    @[instance_reducible]
    @[inline]
    def Std.Http.Headers.get (headers : Headers) (name : Header.Name) (h : name headers) :

    Retrieves the first Header.Value for the given key.

    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.

      Instances For
        @[inline]

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

        Instances For
          @[inline]

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

          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.

            Instances For
              @[inline]

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

              Instances For
                @[inline]

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

                Instances For
                  @[inline]

                  Like get?, but panics if absent.

                  Instances For
                    @[inline]

                    Inserts a new key-value pair into the headers.

                    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.

                      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.

                        Instances For
                          @[inline]

                          Inserts a new key with an array of values.

                          Instances For

                            Creates empty headers.

                            Instances For

                              Creates headers from a list of key-value pairs.

                              Instances For
                                @[inline]

                                Checks if a header with the given name exists.

                                Instances For
                                  @[inline]

                                  Removes a header with the given name.

                                  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.

                                    Instances For
                                      @[inline]

                                      Gets the number of headers.

                                      Instances For
                                        @[inline]

                                        Checks if the headers are empty.

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

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

                                          Instances For

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

                                            Instances For

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

                                              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.

                                                Instances For

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

                                                  Instances For

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

                                                    Instances For

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

                                                      Instances For

                                                        Updates all the values of a header if it exists.

                                                        Instances For
                                                          @[inline]

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

                                                          Instances For
                                                            @[instance_reducible]
                                                            @[instance_reducible]