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
20
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 4.0.0-1 to 4.0.0-2

8

lib/transport/node-fetch.js

@@ -65,7 +65,9 @@ 'use strict';

// currently supports json and text formats only
to.body = await from.text();
const contentType = to.headers['content-type'];
if (this.defaults?.json || contentType?.includes('json')) {
to.body = await from.json();
} else {
to.body = await from.text();
try {
to.body = JSON.parse(to.body);
} catch {} // If body is not parseable, leave as text
}

@@ -72,0 +74,0 @@

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

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

@@ -78,2 +78,13 @@ 'use strict';

it('handles an empty response body when parsing as JSON', async () => {
nock.cleanAll();
api.get(path).reply(200, undefined, defaultHeaders);
const res = await HttpTransport.createClient()
.get(url)
.asResponse();
assert.deepEqual(res.body, '');
});
it('sets a default User-agent for every request', async () => {

@@ -80,0 +91,0 @@ nock.cleanAll();

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