* Phin replacement - simple promisified HTTP client * @param {object} options - Request options * @param {string} options.url - URL to fetch * @param {number} options.timeout - Request timeout (default: 15000) * @returns {Promise<{body: Buffer, statusCode: number, headers: object}>}
(options)
| 239 | * @returns {Promise<{body: Buffer, statusCode: number, headers: object}>} |
| 240 | */ |
| 241 | async function phin (options) { |
| 242 | const { url, timeout = 15000 } = options |
| 243 | const body = await httpGet(url, timeout) |
| 244 | |
| 245 | return { |
| 246 | body: Buffer.from(body), |
| 247 | statusCode: 200, |
| 248 | headers: {} |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | phin.promisified = phin |
| 253 |
no test coverage detected