Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sparkpost

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sparkpost - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

9

lib/transmission.js

@@ -125,2 +125,11 @@ 'use strict';

callback(err);
} else if (typeof res === 'undefined' || typeof res.body === 'undefined') {
/*
* If we're in here then something very strange has happened because we didn't
* get a properly formatted response from the API call, so give generic error
* since that's the best we can do in this case
*
* Note that this is the case for both successful responses and error responses
*/
callback(new Error('Unexpected error occurred while trying to send transmission'));
} else if (res.statusCode !== 200) {

@@ -127,0 +136,0 @@ callback(res.body.errors);

2

package.json
{
"name": "sparkpost",
"version": "0.1.4",
"version": "0.1.5",
"description": "A Node.js wrapper for interfacing with your favorite SparkPost APIs",

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

@@ -18,3 +18,3 @@ function MockRequest() {

MockRequest.prototype.post = function(options, callbackFunction) {
var response = {error: this.error, response: this.response, body: this.response.body};
var response = {error: this.error, response: this.response, body: this.response.body || undefined};
callbackFunction(response.error, response.response, response.body);

@@ -21,0 +21,0 @@ };

@@ -173,2 +173,14 @@ var chai = require('chai')

it('should return a generic error when we get an ill-formed response from the API', function() {
MockRequest.response = {}; // no body
transmission.send({}, function(err, res) {
expect(res).to.be.undefined;
expect(err).to.match(/Unexpected error occurred while trying to send transmission/);
});
MockRequest.restore();
});
it('should return an error if the status code is anything other than 200', function() {

@@ -175,0 +187,0 @@ MockRequest.response.statusCode = 500;

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