cluster-request
Advanced tools
Comparing version 1.1.1 to 2.0.0
@@ -75,8 +75,2 @@ const request = require('request'); | ||
this.lastResponse = { | ||
statusCode: null, | ||
body: null, | ||
response: null, | ||
}; | ||
return new Promise((resolve, reject) => { | ||
@@ -110,4 +104,2 @@ request( | ||
this.lastResponse = Object.assign({}, result); | ||
this.validateResponse(result) | ||
@@ -121,6 +113,2 @@ .then(() => resolve(result)) | ||
getLastResponse() { | ||
return this.lastResponse; | ||
} | ||
/** | ||
@@ -147,3 +135,3 @@ * Validate response | ||
error.statusCode = safeResponse.statusCode; | ||
error.body = response.body; | ||
return Promise.reject(error); | ||
@@ -150,0 +138,0 @@ } |
const ClusterRequest = require('./index'); | ||
const clusterRequest = new ClusterRequest(); | ||
describe('Testing Requests', () => { | ||
@@ -25,4 +24,4 @@ | ||
expect(err.message).toBe('ADVERTISER_NOT_FOUND (404)'); | ||
expect(clusterRequest.getLastResponse().statusCode).toBe(404); | ||
expect(clusterRequest.getLastResponse().body.message).toBe('ADVERTISER_NOT_FOUND'); | ||
expect(err.statusCode).toBe(404); | ||
expect(err.body.message).toBe('ADVERTISER_NOT_FOUND'); | ||
}) | ||
@@ -36,5 +35,5 @@ ); | ||
expect(err.message).toBe('Can\'t parse json'); | ||
expect(clusterRequest.getLastResponse()).toBe(null); | ||
expect(err.statusCode).toBe(undefined); | ||
}) | ||
); | ||
}); |
{ | ||
"name": "cluster-request", | ||
"version": "1.1.1", | ||
"version": "2.0.0", | ||
"description": "A proxy to send requests within a kubernetes cluster", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
9017
212