new Request(options)
The HTTP request wrapper
Parameters:
Name | Type | Description |
---|---|---|
options |
module:request~options | An Object for defining the HTTP client behavior |
- Source:
Throws:
-
-
Parameter 'options' must be an object, not $actualType
- Type
- TypeError
-
-
-
Parameter 'options.url' must be a string, not $actualType
- Type
- TypeError
-
-
-
Parameter 'options.method' must be a string, not $actualType
- Type
- TypeError
-
-
-
Parameter 'options.maxBody' must be a number, not $actualType
- Type
- TypeError
-
-
-
Parameter 'options.progress' must be a function, not $actualType
- Type
- TypeError
-
-
-
Parameter 'options.auth' must be an object, not $actualType
- Type
- TypeError
-
-
-
Invalid value for option.auth.type.
- Type
- Error
-
Methods
-
error(error, callback)
-
Packages the Error object that bubbles up to the user completion callback
Parameters:
Name Type Description error
Error The input error callback
module:request~stdError Completion callback - Source:
-
saveBuffer(callback)
-
Buffers the HTTP response body
Parameters:
Name Type Description callback
module:request~innerCallback Completion callback - Source:
-
saveFile(file, callback)
-
Saves to file the HTTP response body
Parameters:
Name Type Description file
String The file path where the HTTP response body is saved callback
module:request~innerCallback Completion callback - Source:
-
send(callback)
-
Issues the outgoing HTTP request
Parameters:
Name Type Description callback
module:request~sendCallback Completion callback - Source:
Throws:
-
Parameter 'callback' must be a function, not $actualType
- Type
- TypeError
-
setNoCompress()
-
Sets options.noCompress and deletes the request headers that enable this functionality
- Source:
-
stdResult() → {module:request~stdResult}
-
Returns the standard result object, independent on which operation was executed
- Source:
Returns:
result The standard result