Comparing version 1.1.5 to 1.1.6
@@ -14,3 +14,3 @@ "use strict"; | ||
}, requestOptions || {}); | ||
request(options, function (err, data) { | ||
request(options, function (err, response) { | ||
if (err) { | ||
@@ -20,3 +20,7 @@ callback(err); | ||
} | ||
callback(null, data.body && JSON.parse(data.body)); | ||
if (response.statusCode !== 200) { | ||
callback(new Error("Error: " + response.statusMessage + " - " + response.statusMessage)); | ||
return; | ||
} | ||
callback(null, typeof response.body === 'string' && JSON.parse(response.body) || response.body); | ||
}); | ||
@@ -23,0 +27,0 @@ }; |
{ | ||
"name": "kitejs", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "the rpc framework Kite for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,3 +9,3 @@ import { Map } from '../types/lang'; | ||
request(requestOptions: Map<any>, callback) { | ||
public request(requestOptions: Map<any>, callback) { | ||
var service = requestOptions.service; | ||
@@ -17,3 +17,3 @@ delete requestOptions.service; | ||
request(options, function (err, data) { | ||
request(options, function (err, response) { | ||
if (err) { | ||
@@ -23,6 +23,11 @@ callback(err); | ||
} | ||
if (response.statusCode !== 200) { | ||
callback(new Error(`Error: ${response.statusMessage} - ${response.statusMessage}`)); | ||
return; | ||
} | ||
callback(null, data.body && JSON.parse(data.body)); | ||
callback(null, typeof response.body === 'string' && JSON.parse(response.body) || response.body); | ||
}); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71246
1482