New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bbc/http-transport

Package Overview
Dependencies
Maintainers
6
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bbc/http-transport - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

lib/callbacks/decorator.js

27

lib/builder.js

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

const CallbackDecorator = require('./callbacks/decorator');
const HttpTransportClient = require('./client');

@@ -15,6 +16,7 @@

/**
* Configures HttpTransport client
* @param {Transport} transport - Transport instance.
*/
* Configures HttpTransport client
* @param {Transport} transport - Transport instance.
*/
constructor(transport) {
this._callback = false;
this._transport = transport;

@@ -93,2 +95,15 @@ this._defaults = {

/**
* Callbackify the client
*
* @return a HttpTransport instance supporting callbacks
* @example
*
* const client = httpTransport.asCallback().createClient();
*/
asCallback() {
this._callback = true;
return this;
}
/**
* Instantiates a HttpTransport

@@ -103,3 +118,7 @@ *

createClient() {
return new HttpTransportClient(this._transport, this._defaults);
const transportClient = new HttpTransportClient(this._transport, this._defaults);
if (this._callback) {
return new CallbackDecorator(transportClient);
}
return transportClient;
}

@@ -106,0 +125,0 @@ }

8

lib/client.js

@@ -12,6 +12,6 @@ 'use strict';

/**
* Create a HttpTransport.
* @param {Transport} transport - Transport instance.
* @param {object} defaults - default configutation
*/
* Create a HttpTransport.
* @param {Transport} transport - Transport instance.
* @param {object} defaults - default configutation
*/
constructor(transport, defaults) {

@@ -18,0 +18,0 @@ this._transport = transport;

{
"name": "@bbc/http-transport",
"version": "3.0.0",
"version": "3.1.0",
"description": "A flexible, modular REST client built for ease-of-use and resilience.",

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

@@ -14,3 +14,3 @@ 'use strict';

const packageInfo = require('../package');
const toError = require('./toError');
const sandbox = sinon.sandbox.create();

@@ -59,15 +59,2 @@

function toError() {
return async (ctx, next) => {
await next();
if (ctx.res.statusCode >= 400) {
const err = new Error('something bad happend.');
err.statusCode = ctx.res.statusCode;
err.headers = ctx.res.headers;
throw err;
}
};
}
describe('HttpTransportClient', () => {

@@ -74,0 +61,0 @@ beforeEach(() => {

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