Global

Methods

phin(opts, cb)

Sends a request to a server.
Parameters:
Name Type Description
opts Options | String Request options or URL.
cb PhinCallback Called when data is recieved from server.
Source:

Type Definitions

IncomingMessage

Type:
  • Object
Properties:
Name Type Description
body Buffer The data sent by the server.
headers Object Response headers.
httpVersion String HTTP version being used.
rawHeaders Object The raw request/response headers list exactly as they were received.
rawTrailers Array.<String> The raw request/response trailer keys and values exactly as they were received.
socket net.Socket The net.Socket object associated with the connection.
statusCode Number The 3-digit HTTP response status code (eg. 404).
statusMessage String The HTTP response status message (ex. OK, Internal Server Error).
trailers Object The request/response trailers object.
Source:

Options

Type:
  • Object
Properties:
Name Type Attributes Description
url String The URL of the server to send a request to.
compressed Boolean <optional>
Compress the request. Will overwrite the 'Accept-Encoding' header. Defaults to 'false'.
protocol String <optional>
'http:' or 'https:'. Inferred from the URL if not present.
hostname String <optional>
A domain name or IP address of the server to issue the request to. Inferred from the URL if not present.
port Number <optional>
The port to send the request to. Defaults to 80 on HTTP and 443 on HTTPS.
localAddress String <optional>
Local interface to bind for network connections.
socketPath String <optional>
Unix Domain Socket (use one of host:port or socketPath).
method String <optional>
The request method (ex. GET, POST, etc.). Defaults to "GET".
path String <optional>
Request path. Inferred from the URL if not present.
headers Object <optional>
An object with request headers.
auth String <optional>
Basic authentication (ex. ethan:letmein). Inferred from the URL if not present.
timeout Number <optional>
The socket timeout, in milliseconds.
data Buffer | Object <optional>
The data to send to the client. JSON.stringify is automatically called on objects when the 'Content-Type' or 'content-type' header is 'application/json' and querystring.stringify is called on objects when the 'Content-Type' or 'content-type' header is 'x/www-url-form-encoded'.
Source:

PhinCallback(err, res)

Parameters:
Name Type Description
err Error An error that occured. Not present if no error occured.
res IncomingMessage The response from the server.
Source: