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

@bbc/http-transport

Package Overview
Dependencies
Maintainers
19
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.5.7-2 to 3.5.7-3

13

lib/transport/node-fetch.js

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

const to = ctx.res;
const contentType = from.headers?.get('content-type');
REQUIRED_PROPERTIES.forEach((property) => {

@@ -64,10 +63,10 @@ to[property] = from[property];

to.statusCode = from.status;
to.headers = Object.fromEntries(from.headers.entries());
// currently supports json and text formats only
if (from.ok) {
if (contentType?.includes('json')) {
to.body = await from.json();
} else if (contentType?.includes('text')) {
to.body = await from.text();
}
const contentType = to.headers['content-type'];
if (contentType?.includes('json')) {
to.body = await from.json();
} else if (contentType?.includes('text')) {
to.body = await from.text();
}

@@ -74,0 +73,0 @@

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

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

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

const responseBody = requestBody;
const defaultHeaders = { 'Content-Type': 'application/json' };

@@ -43,3 +44,3 @@ function toUpperCase() {

.reply(500);
api[httpMethod](path).reply(successCode, simpleResponseBody);
api[httpMethod](path).reply(successCode, simpleResponseBody, defaultHeaders);
}

@@ -56,3 +57,3 @@

.reply(200);
api[httpMethod](path).reply(successCode, simpleResponseBody);
api[httpMethod](path).reply(successCode, simpleResponseBody, defaultHeaders);
}

@@ -64,8 +65,3 @@

nock.cleanAll();
api
.get(path)
.reply(200, simpleResponseBody)
.defaultReplyHeaders({
'Content-Type': 'application/json'
});
api.get(path).reply(200, simpleResponseBody, defaultHeaders);
});

@@ -598,8 +594,3 @@

nock.cleanAll();
api
.defaultReplyHeaders({
'Content-Type': 'application/json'
})
.get(path)
.reply(200, responseBody);
api.get(path).reply(200, responseBody, defaultHeaders);

@@ -606,0 +597,0 @@ const client = HttpTransport.createBuilder()

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