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

phin

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phin - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

24

lib/phin.js

@@ -53,3 +53,3 @@ "use strict";

*/
const phin = (opts, cb, http) => {
const phin = (opts, cb, injectedHttp) => {
if (typeof(opts) !== "string" && !opts.hasOwnProperty("url")) {

@@ -70,3 +70,3 @@ throw new Error("Missing url option from options for request method.");

"method": "GET",
"headers": { },
"headers": {},
"auth": (addr.auth || null)

@@ -107,3 +107,3 @@ };

http = http || realHttp;
const http = injectedHttp || realHttp;

@@ -118,5 +118,5 @@ switch (addr.protocol.toLowerCase()) {

default:
const err = new Error("Invalid / unknown address protocol. Expected HTTP or HTTPS.");
const err = new Error("Invalid / unknown URL protocol. Expected HTTP or HTTPS.");
if (cb) {
cb(err);
cb(err, null);
}

@@ -128,3 +128,3 @@ return;

if (cb) {
cb(err);
cb(err, null);
}

@@ -137,11 +137,11 @@ });

const contentType = options.headers["Content-Type"] || options.headers["content-type"];
if (contentType === "application/json") {
postData = JSON.stringify(opts.data);
} else if (contentType === "x/www-url-form-encoded") {
if (contentType === "x/www-url-form-encoded") {
postData = qs.stringify(opts.data);
} else {
const err2 = new Error("opts.data was passed in as an object, but the \"Content-Type\" (or \"content-type\") header was not \"application/json\" or \"x/www-url-form-encoded\".");
if (cb) {
cb(err2);
try {
postData = JSON.stringify(opts.data);
}
catch (err) {
cb(new Error("Couldn't stringify object. (Likely due to a circular reference.)"), null);
}
}

@@ -148,0 +148,0 @@ }

{
"name": "phin",
"version": "2.0.2",
"version": "2.1.0",
"description": "Ultra-simple, lightweight, dependency-free Node.JS HTTP request client",

@@ -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