New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wootils

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wootils - npm Package Compare versions

Comparing version 2.6.2 to 2.6.3

revi.js

2

package.json

@@ -5,3 +5,3 @@ {

"homepage": "https://homer0.github.io/wootils/",
"version": "2.6.2",
"version": "2.6.3",
"repository": "homer0/wootils",

@@ -8,0 +8,0 @@ "author": "Leonardo Apiwan (@homer0) <me@homer0.com>",

@@ -332,9 +332,20 @@ const statuses = require('statuses');

responseStatus = response.status;
/**
* If the response should be handled as JSON and it has a `json()` method, return the
* promise of the decoded content, otherwise just return the same object.
*/
return handleAsJSON && response.json ?
response.json() :
response;
let nextStep;
// If the response should be handled as JSON and it has a `json()` method...
if (handleAsJSON && typeof response.json === 'function') {
/**
* Make sure there's a response to be parsed, otherwise just set to return an empty
* object.
*/
if (typeof response.size === 'undefined' || response.size > 0) {
nextStep = response.json();
} else {
nextStep = {};
}
} else {
// If the response shouldn't be handled as JSON, set to return the raw object.
nextStep = response;
}
return nextStep;
})

@@ -341,0 +352,0 @@ .then((response) => (

@@ -345,2 +345,26 @@ jest.unmock('/shared/objectUtils');

it('should make a successfully GET request without decoding an empty response', () => {
// Given
const requestURL = 'http://example.com';
const requestResponse = {
status: 200,
size: 0,
json: jest.fn(),
};
const fetchClient = jest.fn(() => Promise.resolve(requestResponse));
let sut = null;
// When
sut = new APIClient('', '', fetchClient);
return sut.fetch({ url: requestURL })
.then((response) => {
// Then
expect(response).toEqual({});
expect(requestResponse.json).toHaveBeenCalledTimes(0);
expect(fetchClient).toHaveBeenCalledTimes(1);
expect(fetchClient).toHaveBeenCalledWith(requestURL, {
method: 'GET',
});
});
});
it('should make a successfully POST request', () => {

@@ -347,0 +371,0 @@ // Given

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc