lightning-request-net
Advanced tools
Comparing version 0.1.1-beta.0 to 0.1.1-beta.1
{ | ||
"name": "lightning-request-net", | ||
"version": "0.1.1-beta.0", | ||
"version": "0.1.1-beta.1", | ||
"description": "Lightweight Node.js HTTP client based on net.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -66,6 +66,10 @@ const http = require('http'); | ||
if (result.statusCode === 200 && responseType === 'json') { | ||
if (options.allowBigNumberInJSON) { | ||
result.data = jsonParse(result.data); | ||
} else { | ||
result.data = JSON.parse(result.data); | ||
try { | ||
if (options.allowBigNumberInJSON) { | ||
result.data = jsonParse(result.data); | ||
} else { | ||
result.data = JSON.parse(result.data); | ||
} | ||
} catch (error) { | ||
reject(error); | ||
} | ||
@@ -72,0 +76,0 @@ } |
@@ -25,9 +25,6 @@ const net = require('net'); | ||
this.writeCacheData = null; | ||
this.successCall = loop; | ||
this.failCall = loop; | ||
this.contentLength = 0; | ||
this.chunked = false; | ||
this.bodySize = 0; | ||
@@ -34,0 +31,0 @@ this.data = ''; // received data |
@@ -57,3 +57,3 @@ const CRLF = '\r\n'; | ||
} | ||
const idx2 = responseBodyText.indexOf('\r\n0\r\n'); | ||
const idx2 = responseBodyText.indexOf('\r\n0'); | ||
if (idx2 > -1) { | ||
@@ -60,0 +60,0 @@ responseBodyText = responseBodyText.slice(0, idx2); |
27186
322