HttpClient
HTTP Client
Constructor Summary
Public Constructor | ||
public |
constructor(opts: object) Constructor. |
Method Summary
Public Methods | ||
public |
async beforeError(err: HttpError): Promise<boolean> hook async function called before throw an error. |
|
public |
async beforeRequest(path: String, ctx: object) hook async function called before the request. |
|
public |
do DELETE request. |
|
public |
async exec(method: string, path: string, query: object, body: string | object, headers: object): Promise: * execute http request. |
|
public |
do GET request. |
|
public |
do PATCH request. |
|
public |
do POST request. |
|
public |
do PUT request. |
Private Methods | ||
private |
_formatParams(params: *): * |
|
private |
_fromFormData(body: *): * |
|
private |
_request(method: *, path: *, objectPattern2: {"query": *, "body": *, "headers": *}): * |
Public Constructors
Public Methods
public async beforeError(err: HttpError): Promise<boolean> source
hook async function called before throw an error.
Params:
Name | Type | Attribute | Description |
err | HttpError | request path |
public async beforeRequest(path: String, ctx: object) source
hook async function called before the request.
public async exec(method: string, path: string, query: object, body: string | object, headers: object): Promise: * source
execute http request.
Private Methods
private _request(method: *, path: *, objectPattern2: {"query": *, "body": *, "headers": *}): * source
Params:
Name | Type | Attribute | Description |
method | * | ||
path | * | ||
objectPattern2 | {"query": *, "body": *, "headers": *} |
|
Return:
* |