Module

Node.HTTP.Client

This module defines low-level bindings to the Node HTTP client.

#Request

data Request

A HTTP request object

#Response

data Response

A HTTP response object

#RequestHeaders

newtype RequestHeaders

A HTTP request object

Constructors

#RequestOptions

data RequestOptions

The type of HTTP request options

#RequestFamily

data RequestFamily

Values for the family request option

Constructors

#protocol

protocol :: Option RequestOptions String

The protocol to use

#hostname

hostname :: Option RequestOptions String

Domain name or IP

#port

port :: Option RequestOptions Int

Port of remote server

#method

method :: Option RequestOptions String

The HTTP request method: GET, POST, etc.

#path

path :: Option RequestOptions String

The request path, including query string if appropriate.

#auth

auth :: Option RequestOptions String

Basic authentication

#key

#cert

cert :: Option RequestOptions String

Public x509 certificate

#rejectUnauthorized

rejectUnauthorized :: Option RequestOptions Boolean

Is cert verified against CAs

#family

family :: Option RequestOptions RequestFamily

IP address family to use when resolving hostname. Valid values are IPV6 and IPV4

#request

request :: Options RequestOptions -> (Response -> Effect Unit) -> Effect Request

Make a HTTP request using the specified options and response callback.

#requestFromURI

requestFromURI :: String -> (Response -> Effect Unit) -> Effect Request

Make a HTTP request from a URI string and response callback.

#requestAsStream

requestAsStream :: forall r. Request -> Writable r

Create a writable stream from a request object.

#responseAsStream

responseAsStream :: forall w. Response -> Readable w

Create a readable stream from a response object.

#setTimeout

setTimeout :: Request -> Int -> Effect Unit -> Effect Unit

Set the socket timeout for a Request

#httpVersion

httpVersion :: Response -> String

Get the request HTTP version

#responseHeaders

responseHeaders :: Response -> Object String

Get the response headers as a hash Cookies are not included and could be retrieved with responseCookies

#responseCookies

responseCookies :: Response -> Maybe (Array String)

Get the response cookies as Just (Array String) or Nothing if no cookies

#statusCode

statusCode :: Response -> Int

Get the response status code

#statusMessage

statusMessage :: Response -> String

Get the response status message

Modules