Socket
Socket
Sign inDemoInstall

popsicle

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

popsicle - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

2

bower.json
{
"name": "popsicle",
"main": "popsicle.js",
"version": "0.3.4",
"version": "0.3.5",
"homepage": "https://github.com/blakeembrey/popsicle",

@@ -6,0 +6,0 @@ "authors": [

{
"name": "popsicle",
"version": "0.3.4",
"version": "0.3.5",
"description": "Simple HTTP requests for node and the browser",

@@ -5,0 +5,0 @@ "main": "popsicle.js",

@@ -268,3 +268,3 @@ (function () {

if (qs == null || qs === '') {
return {};
return null;
}

@@ -395,10 +395,2 @@

var body = response.body;
// Set the body to `null` for empty responses.
if (body === '') {
response.body = null;
return response;
}
var type = response.type();

@@ -408,3 +400,3 @@

if (JSON_MIME_REGEXP.test(type)) {
response.body = JSON.parse(body);
response.body = body === '' ? null : JSON.parse(body);
} else if (QUERY_MIME_REGEXP.test(type)) {

@@ -411,0 +403,0 @@ response.body = parseQuery(body);

@@ -481,2 +481,29 @@ var isNode = typeof window === 'undefined';

});
it('should keep non-parsable responses as empty strings', function () {
return popsicle({
url: REMOTE_URL + '/echo',
method: 'post',
headers: {
'Content-Type': 'text/html'
}
})
.then(function (res) {
expect(res.body).to.equal('');
});
});
it('should set responses to null when empty', function () {
return popsicle({
url: REMOTE_URL + '/echo',
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
})
.then(function (res) {
expect(res.body).to.equal(null);
expect(res.type()).to.equal('application/json');
});
});
});

@@ -483,0 +510,0 @@

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