Socket
Socket
Sign inDemoInstall

heroku-client

Package Overview
Dependencies
Maintainers
2
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

heroku-client - npm Package Compare versions

Comparing version 1.8.1 to 1.9.0

17

lib/request.js

@@ -27,2 +27,3 @@ 'use strict';

this.deferred = q.defer();
this.parseJSON = options.hasOwnProperty('parseJSON') ? options.parseJSON : true;
this.nextRange = 'id ]..; max=1000';

@@ -223,2 +224,14 @@ this.logger = logfmt.namespace({

/*
* Get the request body, and parse it (or not) as appropriate.
* - Parse JSON by default.
* - If parseJSON is `false`, it will not parse.
*/
Request.prototype.parseBody = function parseBody(body) {
if (this.parseJSON) {
return JSON.parse(body || '{}');
} else {
return body;
}
};

@@ -249,3 +262,3 @@ /*

err.statusCode = res.statusCode;
err.body = JSON.parse(buffer || '{}');
err.body = this.parseBody(buffer);

@@ -265,3 +278,3 @@ deferred.reject(err);

var deferred = this.deferred;
var body = JSON.parse(buffer || '{}');
var body = this.parseBody(buffer);

@@ -268,0 +281,0 @@ this.setCache(res, body);

2

package.json
{
"name": "heroku-client",
"version": "1.8.1",
"version": "1.9.0",
"description": "A wrapper for the Heroku v3 API",

@@ -5,0 +5,0 @@ "main": "./lib/heroku.js",

@@ -29,3 +29,3 @@ # heroku-client [![Build Status](https://travis-ci.org/jclem/node-heroku-client.png?branch=master)](https://travis-ci.org/jclem/node-heroku-client)

Docs are auto-generated and live in the
[docs directory](https://github.com/heroku/node-heroku-client/tree/development/docs).
[docs directory](https://github.com/heroku/node-heroku-client/tree/master/docs).

@@ -119,3 +119,4 @@ ## Usage

'Foo': 'Bar'
}
},
parseJSON: false
}, function (err, responseBody) {

@@ -122,0 +123,0 @@ });

@@ -193,2 +193,16 @@ 'use strict';

it('parses JSON by default', function(done) {
makeRequest('/apps', {}, function(err, body) {
expect(body).toEqual({ message: 'ok' });
done();
});
});
it('can accept `false` to parseJSON', function(done) {
makeRequest('/apps', { parseJSON: false }, function(err, body) {
expect(body).toEqual('{ "message": "ok" }');
done();
});
});
it('accepts a host', function(done) {

@@ -195,0 +209,0 @@ makeRequest('/apps', { host: 'api.example.com' }, 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