Classes
Methods
(async) beforeError(err) → {Promise.<boolean>}
hook async function called before throw an error.
Parameters:
Name | Type | Description |
---|---|---|
err |
HttpError | request path |
- Source:
Returns:
- if return false, stop throwing the error.
- Type
- Promise.<boolean>
(async) beforeError(err) → {Promise.<boolean>}
hook async function called before throw an error.
Parameters:
Name | Type | Description |
---|---|---|
err |
HttpError | request path |
- Source:
Returns:
- if return false, stop throwing the error.
- Type
- Promise.<boolean>
(async) beforeRequest(path, ctxopt)
hook async function called before the request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
String | request path | |||||||||||||||||
ctx |
object |
<optional> |
context
Properties
|
- Source:
(async) beforeRequest(path, ctxopt)
hook async function called before the request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
String | request path | |||||||||||||||||
ctx |
object |
<optional> |
context
Properties
|
- Source:
delete(path, ctxopt) → {Promise.<{status:number, headers:object, body: *}>}
do DELETE request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
String | request path | |||||||||||||||||
ctx |
object |
<optional> |
context
Properties
|
- Source:
Returns:
Promise resolving to an object with response details
- Type
- Promise.<{status:number, headers:object, body: *}>
delete(path, ctxopt) → {Promise.<{status:number, headers:object, body: *}>}
do DELETE request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
String | request path | |||||||||||||||||
ctx |
object |
<optional> |
context
Properties
|
- Source:
Returns:
Promise resolving to an object with response details
- Type
- Promise.<{status:number, headers:object, body: *}>
(async) exec(method, path, query, body, headers) → {Promise.<{status:number, headers:object, body: *}>}
execute http request.
Parameters:
Name | Type | Description |
---|---|---|
method |
string | method |
path |
string | request path |
query |
object | request query data |
body |
string | object | request body |
headers |
object | header name and value object |
- Source:
Returns:
Promise resolving to an object with response details
- Type
- Promise.<{status:number, headers:object, body: *}>
(async) exec(method, path, query, body, headers) → {Promise.<{status:number, headers:object, body: *}>}
execute http request.
Parameters:
Name | Type | Description |
---|---|---|
method |
string | method |
path |
string | request path |
query |
object | request query data |
body |
string | object | request body |
headers |
object | header name and value object |
- Source:
Returns:
Promise resolving to an object with response details
- Type
- Promise.<{status:number, headers:object, body: *}>
get(path, ctxopt) → {Promise.<{status:number, headers:object, body: *}>}
do GET request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
String | request path | |||||||||||||||||
ctx |
object |
<optional> |
context
Properties
|
- Source:
Returns:
Promise resolving to an object with response details
- Type
- Promise.<{status:number, headers:object, body: *}>
get(path, ctxopt) → {Promise.<{status:number, headers:object, body: *}>}
do GET request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
String | request path | |||||||||||||||||
ctx |
object |
<optional> |
context
Properties
|
- Source:
Returns:
Promise resolving to an object with response details
- Type
- Promise.<{status:number, headers:object, body: *}>
patch(path, ctxopt) → {Promise.<{status:number, headers:object, body: *}>}
do PATCH request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
String | request path | |||||||||||||||||
ctx |
object |
<optional> |
context
Properties
|
- Source:
Returns:
Promise resolving to an object with response details
- Type
- Promise.<{status:number, headers:object, body: *}>
patch(path, ctxopt) → {Promise.<{status:number, headers:object, body: *}>}
do PATCH request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
String | request path | |||||||||||||||||
ctx |
object |
<optional> |
context
Properties
|
- Source:
Returns:
Promise resolving to an object with response details
- Type
- Promise.<{status:number, headers:object, body: *}>
post(path, ctxopt) → {Promise.<{status:number, headers:object, body: *}>}
do POST request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
String | request path | |||||||||||||||||
ctx |
object |
<optional> |
context
Properties
|
- Source:
Returns:
Promise resolving to an object with response details
- Type
- Promise.<{status:number, headers:object, body: *}>
post(path, ctxopt) → {Promise.<{status:number, headers:object, body: *}>}
do POST request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
String | request path | |||||||||||||||||
ctx |
object |
<optional> |
context
Properties
|
- Source:
Returns:
Promise resolving to an object with response details
- Type
- Promise.<{status:number, headers:object, body: *}>
put(path, ctxopt) → {Promise.<{status:number, headers:object, body: *}>}
do PUT request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
String | request path | |||||||||||||||||
ctx |
object |
<optional> |
context
Properties
|
- Source:
Returns:
Promise resolving to an object with response details
- Type
- Promise.<{status:number, headers:object, body: *}>
put(path, ctxopt) → {Promise.<{status:number, headers:object, body: *}>}
do PUT request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
String | request path | |||||||||||||||||
ctx |
object |
<optional> |
context
Properties
|
- Source:
Returns:
Promise resolving to an object with response details
- Type
- Promise.<{status:number, headers:object, body: *}>