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

ft-poller

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ft-poller - npm Package Compare versions

Comparing version 2.8.6 to 2.9.0

src/errors.js

2

package.json

@@ -1,1 +0,1 @@

{"name":"ft-poller","version":"2.8.6","repository":{"type":"git","url":"https://github.com/Financial-Times/ft-poller"},"license":"MIT","description":"An http client to periodically fetch and cache data from web services","main":"./src/server.js","directories":{"lib":"./lib"},"dependencies":{"isomorphic-fetch":"^2.0.0","n-eager-fetch":"^2.0.0"},"devDependencies":{"chai":"^3.3.0","eslint":"^2.9.0","lintspaces-cli":"^0.1.1","mocha":"^2.3.3","nock":"^2.13.0","npm-prepublish":"^1.2.2","sinon":"^1.10.3","timer-shim":"^0.3.0"}}
{"name":"ft-poller","version":"2.9.0","repository":{"type":"git","url":"https://github.com/Financial-Times/ft-poller"},"license":"MIT","description":"An http client to periodically fetch and cache data from web services","main":"./src/server.js","directories":{"lib":"./lib"},"dependencies":{"isomorphic-fetch":"^2.0.0","n-eager-fetch":"^2.0.0"},"devDependencies":{"chai":"^3.3.0","eslint":"^2.9.0","lintspaces-cli":"^0.1.1","mocha":"^2.3.3","nock":"^2.13.0","npm-prepublish":"^1.2.2","sinon":"^1.10.3","timer-shim":"^0.3.0"}}
'use strict';
const errors = require('./errors');

@@ -84,6 +85,6 @@ require ('isomorphic-fetch');

const latency = new Date () - time;
if (response.status === 200) {
if (response.ok) {
this.emit ('ok', response, latency);
} else {
throw new Error (`Fetching ${response.url} failed with a ${response.status}, ${response.statusText}`);
throw new errors.HttpError({url:this.url, method:this.options.method || 'GET', response});
}

@@ -90,0 +91,0 @@ if ((response.headers.get ('content-type') || '').indexOf ('json') > -1) {

@@ -8,2 +8,3 @@ /* global it, describe, xit */

const expect = chai.expect;
const HttpError = require('../src/errors').HttpError;

@@ -165,2 +166,3 @@ describe ('Poller', function () {

expect (eventEmitterStub.getCall (0).args[0]).to.equal ('error');
expect(eventEmitterStub.getCall (0).args[1]).to.be.an.instanceOf(HttpError);
done ();

@@ -167,0 +169,0 @@ }, 10);

Sorry, the diff of this file is not supported yet

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