(url, qs)
| 5 | const request = require('request'); |
| 6 | |
| 7 | function http(url, qs) { |
| 8 | const options = { |
| 9 | url, qs, json: true, |
| 10 | }; |
| 11 | |
| 12 | return new Promise((resolve, reject) => { |
| 13 | request(options, (err, resp) => { |
| 14 | if (err) { |
| 15 | console.log(err); |
| 16 | return reject({ err }); |
| 17 | } |
| 18 | if (resp.body.status !== 'OK') { |
| 19 | console.log(resp.body.status); |
| 20 | return reject({ err: resp.body.status }); |
| 21 | } |
| 22 | |
| 23 | return resolve(resp.body); |
| 24 | }); |
| 25 | }); |
| 26 | } |
| 27 | |
| 28 | function locationFromAddress(params) { |
| 29 | if (!params.address) return Promise.reject('Missing mandatory property: address'); |
no outgoing calls
no test coverage detected