Module

HTTPure.Headers

Package
purescript-httpure
Repository
citizennet/purescript-httpure

#Headers Source

newtype Headers

The Headers type is just sugar for a Object of Strings that represents the set of headers in an HTTP request or response.

Constructors

Instances

#empty Source

empty :: Headers

Return a Headers containing nothing.

#headers Source

headers :: Array (Tuple String String) -> Headers

Convert an Array of Tuples of 2 Strings to a Headers object.

#header Source

header :: String -> String -> Headers

Create a singleton header from a key-value pair.

#read Source

read :: Request -> Headers

Get the headers out of a HTTP Request object.

We intentionally filter out "Set-Cookie" headers here as according to the node.js docs, the "set-cookie" header is always represented as an array, and trying to read it as String would cause a runtime type error. See https://nodejs.org/api/http.html#messageheaders.

#toString Source

toString :: Headers -> String

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

#write Source

write :: Response -> Headers -> Effect Unit

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