Module

Bucketchain.Http

#Http

newtype Http

The type of a HTTP stream.

#toRequest

toRequest :: Http -> Request

Convert a HTTP stream to a Request stream.

#httpStream

httpStream :: Request -> Response -> Http

Create a HTTP stream.

#httpVersion

httpVersion :: Http -> String

Get the request HTTP version.

#requestHeaders

requestHeaders :: Http -> Object String

Get the request headers.

#requestMethod

requestMethod :: Http -> String

Get the request method (GET, POST, etc.).

#requestOriginalURL

requestOriginalURL :: Http -> String

Get the request original URL.

#requestURL

requestURL :: Http -> String

Get the request URL.

#requestBody

requestBody :: Http -> Aff String

Get the request body.

#toReadable

toReadable :: Http -> Readable ()

Convert a Http stream to a Readable stream.

#responseHeader

responseHeader :: Http -> String -> Maybe String

Get a response header value by header name.

#responseHeaders

responseHeaders :: Http -> String -> Array String

Get response header values by header name.

#statusCode

statusCode :: Http -> Int

Get the status code.

#setHeader

setHeader :: Http -> String -> String -> Effect Unit

Set a header with a single value.

#setHeaders

setHeaders :: Http -> String -> Array String -> Effect Unit

Set a header with multiple values.

#setRequestURL

setRequestURL :: Http -> String -> Effect Unit

Set the request URL.

#setStatusCode

setStatusCode :: Http -> Int -> Effect Unit

Set the status code.

#setStatusMessage

setStatusMessage :: Http -> String -> Effect Unit

Set the status message.

#toWritable

toWritable :: Http -> Writable ()

This is for internal. Do not use it.

#onFinish

onFinish :: Http -> Effect Unit -> Effect Unit

Listen finish event of a response stream.

Modules