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
Newtype RequestHeaders _
Lookup RequestHeaders String String
Show RequestHeaders
Allow a
RequestHeaders
to be represented as a string. This string is formatted in HTTP headers format.Eq RequestHeaders
Compare two
RequestHeaders
objects by comparing the underlyingObjects
.Semigroup RequestHeaders
Allow one
RequestHeaders
objects to be appended to another.
#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 underlyingObjects
.
#ToHeaders Source
class ToHeaders r where
Members
headers :: r -> ResponseHeaders
Create
ResponseHeaders
from a record, anArray (Tuple String String)
or anArray (Tuple String (Array String))
Instances
#ToHeadersHelper Source
class ToHeadersHelper :: forall k. Row Type -> k -> Constraint
class ToHeadersHelper r rl where
Members
headersImpl :: Proxy rl -> Record r -> ResponseHeaders
Instances
ToHeadersHelper r Nil
(IsSymbol sym, RowToList r rl, RowToList tail tailRL, Cons sym String tail r, Lacks sym tail, ToHeadersHelper tail tailRL) => ToHeadersHelper r (Cons sym String tailRL)
(IsSymbol sym, RowToList r rl, RowToList tail tailRL, Cons sym (Array String) tail r, Lacks sym tail, ToHeadersHelper tail tailRL) => ToHeadersHelper r (Cons sym (Array String) tailRL)
#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
.
- Modules
- HTTPurple
- HTTPurple.
Body - HTTPurple.
Cont - HTTPurple.
Headers - HTTPurple.
Json - HTTPurple.
Lookup - HTTPurple.
Method - HTTPurple.
Middleware - HTTPurple.
NodeMiddleware - HTTPurple.
Path - HTTPurple.
Query - HTTPurple.
Request - HTTPurple.
Response - HTTPurple.
Routes - HTTPurple.
Server - HTTPurple.
Status - HTTPurple.
Utils - HTTPurple.
Validation - HTTPurple.
Version
Given a string, return a
Maybe
containing the value of the matching header, if there is any.