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.5 to 0.3.6

2

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

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

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

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

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

function type (str) {
return str.split(/ *; */)[0];
return str == null ? '' : str.split(/ *; */)[0];
}

@@ -397,2 +397,8 @@

if (body === '') {
response.body = null;
return response;
}
try {

@@ -545,22 +551,6 @@ if (JSON_MIME_REGEXP.test(type)) {

var contentType = this.headers['content-type'];
return contentType && type(contentType);
return type(this.headers['content-type']);
};
/**
* Return or set the accept header.
*
* @param {String} [value]
* @return {String}
*/
Headers.prototype.accept = function (value) {
if (value) {
return this.set('Accept', value);
}
return this.headers.accept;
};
/**
* Create a response instance.

@@ -567,0 +557,0 @@ *

@@ -482,12 +482,9 @@ var isNode = typeof window === 'undefined';

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

@@ -511,13 +508,2 @@ });

describe('accept', function () {
it('should set the accept header', function () {
return popsicle(REMOTE_URL + '/echo/header/accept')
.accept('application/json')
.then(function (res) {
expect(res.body).to.equal('application/json');
expect(res.type()).to.equal('text/html');
});
});
});
describe('request errors', function () {

@@ -524,0 +510,0 @@ it('should error when requesting an unknown domain', function () {

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