new Base()
Base prototype for Client
and DB
.
Encapsulates HTTP methods, JSON handling, and response coersion.
Methods
request(methodopt, pathopt, queryopt, bodyopt, headersopt, callbackopt) → {Promise}
Service request and parse JSON response.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
method |
String |
<optional> |
GET | HTTP method. |
path |
String |
<optional> |
this.uri | HTTP URI. |
query |
Object |
<optional> |
HTTP query options. |
|
body |
Object |
<optional> |
HTTP body. |
|
headers |
Object |
<optional> |
HTTP headers. |
|
callback |
handler |
<optional> |
Callback function. |
Returns:
A Promise, if no callback is provided,
otherwise null
.
- Type
- Promise