Module

Erl.Cowboy.Req

Package
erl-cowboy
Repository
purerl/purescript-erl-cowboy

Bindings for cowboy_req

The Req type (corresponding to req()) is core to the use of cowboy, containing information about request and response. Many functions operating on Req are pure, producing an updated Req if required to update some fields, e.g. when setting a header, but others produce a result in Effect as even though they may update the Req, they also cause side-effects such as sending traffic on the network (eg reply).

#StatusCode Source

newtype StatusCode

Constructors

#Req Source

data Req :: Type

#reply Source

reply :: StatusCode -> Headers -> String -> Req -> Effect Req

Send the reply including the given body content (cowboy_req:reply/4)

#replyWithoutBody Source

replyWithoutBody :: StatusCode -> Headers -> Req -> Effect Req

Send the reply without setting the body (cowboy_req:reply/3)

#replyStatus Source

replyStatus :: StatusCode -> Req -> Effect Req

Send the reply with already set headers and body (cowboy_req:reply/2)

#method Source

#Version Source

#version Source

#scheme Source

#binding Source

binding :: forall a. Atom -> Req -> Maybe a

#bindingWithDefault Source

bindingWithDefault :: forall a. Atom -> Req -> a -> a

#port Source

port :: Req -> Int

#headers Source

#setHeader Source

#setBody Source

setBody :: String -> Req -> Req

Set response body. As should be apparent from the type, this does not actually send the body but merely sets it in the Req, the body is sent once reply is called.

#streamBody Source

#streamBodyFinal Source