WIP: initial prototype

- Do not serilize keys with undefined values in querystring
- Added promises support in Transport.request
This commit is contained in:
delvedor
2018-12-12 19:47:33 +01:00
parent a86a552a85
commit f6020e68a4
2 changed files with 15 additions and 1 deletions

View File

@ -34,10 +34,21 @@ class Transport {
}
request (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
this.request(params, options, (err, result) => {
err ? reject(err) : resolve(result)
})
})
}
callback = once(callback)
// TODO: return in the result the metadata
const meta = {