-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Methods
- - - - - - - -(async) phin(options) → {Promise.<http.serverResponse>}
- - - - - - -Parameters:
- - -Name | - - -Type | - - - - - -Description | -
---|---|---|
options |
-
-
- - - -phinOptions -| - -string - - - - | - - - - - -phin options object (or string for auto-detection) | -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source: -
- - - - - - - - -
Returns:
- - --
-
- - Type - -
- - -Promise.<http.serverResponse> - - - -
Type Definitions
- - - -phinOptions
- - - - -Type:
--
-
- - -Object - - - -
Properties:
- - - -Name | - - -Type | - - -Attributes | - - - -Default | - - -Description | -
---|---|---|---|---|
url |
-
-
- - - -string - - - - | - - -- - - - | - - - -- - | - - -URL to request (autodetect infers from this URL) | -
method |
-
-
- - - -string - - - - | - - -
-
- <optional> - - - - |
-
-
-
- - - GET - - | - - -Request method ('GET', 'POST', etc.) | -
data |
-
-
- - - -string -| - -Buffer -| - -object - - - - | - - -
-
- <optional> - - - - |
-
-
-
- - - | - - -Data to send as request body (phin may attempt to convert this data to a string if it isn't already) | -
form |
-
-
- - - -Object - - - - | - - -
-
- <optional> - - - - |
-
-
-
- - - | - - -Object to send as form data (sets 'Content-Type' and 'Content-Length' headers, as well as request body) (overwrites 'data' option if present) | -
headers |
-
-
- - - -Object - - - - | - - -
-
- <optional> - - - - |
-
-
-
- - - {} - - | - - -Request headers | -
core |
-
-
- - - -Object - - - - | - - -
-
- <optional> - - - - |
-
-
-
- - - {} - - | - - -Custom core HTTP options | -
parse |
-
-
- - - -string - - - - | - - -
-
- <optional> - - - - |
-
-
-
- - - none - - | - - -Response parsing. Errors will be given if the response can't be parsed. 'none' returns body as a `Buffer`, 'json' attempts to parse the body as JSON, and 'string' attempts to parse the body as a string | -
followRedirects |
-
-
- - - -boolean - - - - | - - -
-
- <optional> - - - - |
-
-
-
- - - false - - | - - -Enable HTTP redirect following | -
stream |
-
-
- - - -boolean - - - - | - - -
-
- <optional> - - - - |
-
-
-
- - - false - - | - - -Enable streaming of response. (Removes body property) | -
compression |
-
-
- - - -boolean - - - - | - - -
-
- <optional> - - - - |
-
-
-
- - - false - - | - - -Enable compression for request | -
timeout |
-
-
- - - -number - - - - | - - -
-
- <optional> - - - - <nullable> - - |
-
-
-
- - - null - - | - - -Request timeout in milliseconds | -
hostname |
-
-
- - - -string - - - - | - - -
-
- <optional> - - - - |
-
-
-
- - - autodetect - - | - - -URL hostname | -
port |
-
-
- - - -Number - - - - | - - -
-
- <optional> - - - - |
-
-
-
- - - autodetect - - | - - -URL port | -
path |
-
-
- - - -string - - - - | - - -
-
- <optional> - - - - |
-
-
-
- - - autodetect - - | - - -URL path | -
phinResponseCallback(errornullable, phinResponsenullable)
- - - - - - -Parameters:
- - -Name | - - -Type | - - -Attributes | - - - - -Description | -
---|---|---|---|
error |
-
-
- - - -Error -| - -string - - - - | - - -
-
-
-
- <nullable> - - - - |
-
-
-
-
- Error if any occurred in request, otherwise null. | -
phinResponse |
-
-
- - - -http.serverResponse - - - - | - - -
-
-
-
- <nullable> - - - - |
-
-
-
-
- phin response object. Like http.ServerResponse but has a body property containing response body, unless stream. If stream option is enabled, a stream property will be provided to callback with a readable stream. | -