accept-json
Advanced tools
Comparing version 1.0.2 to 1.0.3
10
index.js
@@ -28,6 +28,6 @@ const http = require('http'); | ||
if (options.timeout) this.endpoint.timeout = options.timeout; | ||
this.headers = Object.assign({'accept': 'application/json'}, options.headers); | ||
this.timeout = options.timeout; | ||
if (options.token) { | ||
@@ -190,9 +190,7 @@ this.headers.authorization = `Bearer ${options.token}`; | ||
if (this.timeout) { | ||
req.setTimeout(this.timeout, () => req.abort()); | ||
} | ||
req.on('error', error => callbacks[callbacks.length - 1](error)); | ||
req.on('timeout', () => req.abort()); | ||
req.end(reqBody); | ||
} |
{ | ||
"name": "accept-json", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Simple client for HTTP JSON APIs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
15097
154