Socket
Socket
Sign inDemoInstall

node-superfetch

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-superfetch - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

18

index.js

@@ -22,9 +22,12 @@ const fetch = require('node-fetch');

headers: this.headers,
follow: this.redirect
follow: this.redirect,
body: this.body
});
const raw = await response.buffer();
const headers = {};
for (const [header, value] of Object.entries(response.headers.raw())) headers[header] = value.join('');
const res = {
status: response.status,
statusText: response.statusText,
headers: response.headers.raw(),
headers,
ok: response.ok,

@@ -82,3 +85,12 @@ raw,

send(body) {
send(body, raw = false) {
if (!raw && body !== null && typeof body === 'object') {
const header = this.headers['content-type'];
if (header) {
if (/application\/json/gi.test(header)) body = JSON.stringify(body);
} else {
this.set({ 'Content-Type': 'application/json' });
body = JSON.stringify(body);
}
}
this.body = body;

@@ -85,0 +97,0 @@ return this;

2

package.json
{
"name": "node-superfetch",
"version": "0.0.1",
"version": "0.0.2",
"description": "A wrapper for node-fetch that makes it appear like superagent.",

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

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