Huge News!Announcing our $40M Series B led by Abstract Ventures.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.1 to 2.6.2

2

package.json

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

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

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

@@ -314,5 +314,8 @@ const statuses = require('statuses');

if (typeof opts.body === 'object') {
// ...encode it.
opts.body = JSON.stringify(opts.body);
// And if no `Content-Type` was defined, let's assume is a JSON request.
// ...and if it's an object literal...
if (Object.getPrototypeOf(opts.body).constructor.name === 'Object') {
// ...encode it.
opts.body = JSON.stringify(opts.body);
}
// If no `Content-Type` was defined, let's assume is a JSON request.
if (!hasContentType) {

@@ -319,0 +322,0 @@ opts.headers['Content-Type'] = 'application/json';

@@ -597,2 +597,36 @@ jest.unmock('/shared/objectUtils');

it('shouldn\'t encode the body if is not an object literal', () => {
// Given
const requestURL = 'http://example.com';
const requestMethod = 'post';
class CustomFormData {}
const requestBody = new CustomFormData();
const requestResponseData = {
message: 'hello-world',
};
const requestResponse = {
status: 200,
json: jest.fn(() => Promise.resolve(requestResponseData)),
};
const fetchClient = jest.fn(() => Promise.resolve(requestResponse));
const headers = {
'Content-Type': 'application/custom-form-data',
};
let sut = null;
// When
sut = new APIClient('', '', fetchClient);
return sut.post(requestURL, requestBody, { headers })
.then((response) => {
// Then
expect(response).toEqual(requestResponseData);
expect(requestResponse.json).toHaveBeenCalledTimes(1);
expect(fetchClient).toHaveBeenCalledTimes(1);
expect(fetchClient).toHaveBeenCalledWith(requestURL, {
headers,
method: requestMethod.toUpperCase(),
body: requestBody,
});
});
});
it('should make a successfully PUT request using the shortcut method', () => {

@@ -599,0 +633,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