Module

HTTPurple.Headers

Package
purescript-httpurple
Repository
sigma-andex/purescript-httpurple

#RequestHeaders Source

newtype RequestHeaders

The RequestHeaders type is a wrapper for a map that represents the set of headers in an HTTP request. A request header contains maximum one value per key.

Constructors

Instances

#ResponseHeaders Source

newtype ResponseHeaders

The ResponseHeaders type is a wrapper for a map that represents the set of headers in an HTTP response. A response header can contain multiple values per key, e.g. in the case of multiple Set-Cookie directives.

Constructors

Instances

  • Semigroup ResponseHeaders

    Allow one ResponseHeaders objects to be appended to another.

  • Show ResponseHeaders

    Allow a ResponseHeaders to be represented as a string. This string is formatted in HTTP headers format.

  • Eq ResponseHeaders

    Compare two ResponseHeaders objects by comparing the underlying Objects.

#ToHeaders Source

class ToHeaders r  where

Members

  • headers :: r -> ResponseHeaders

    Create ResponseHeaders from a record, an Array (Tuple String String) or an Array (Tuple String (Array String))

Instances

#ToHeadersHelper Source

class ToHeadersHelper :: forall k. Row Type -> k -> Constraintclass ToHeadersHelper r rl  where

Members

Instances

#empty Source

empty :: ResponseHeaders

Return a ResponseHeaders containing no headers.

#header Source

header :: String -> String -> ResponseHeaders

Create a singleton header from a key-value pair.

#mkRequestHeader Source

mkRequestHeader :: String -> String -> RequestHeaders

Create a singleton header from a key-value pair. This is intended mainly for internal use.

#mkRequestHeaders Source

mkRequestHeaders :: Array (Tuple String String) -> RequestHeaders

Convert an Array of Tuples of 2 Strings to a RequestHeaders object. This is intended mainly for internal use.

#read Source

read :: IncomingMessage IMServer -> RequestHeaders

Get the headers out of a HTTP RequestHeaders object.

#toResponseHeaders Source

toResponseHeaders :: RequestHeaders -> ResponseHeaders

Copy the request headers to the response headers This is intended mainly for internal use.

#write Source

write :: ServerResponse -> ResponseHeaders -> Effect Unit

Given an HTTP Response and a ResponseHeaders object, return an effect that will write the ResponseHeaders to the Response.