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 1.0.6 to 1.0.7

7

lib/phin.js

@@ -10,3 +10,2 @@ "use strict";

if (typeof(opts) !== "string" && !opts.hasOwnProperty("url")) throw "Missing url option from options for request method.";
if (!cb) throw "Missing callback for request method.";

@@ -47,3 +46,3 @@ var addr;

res.on("end", () => {
cb(null, resBody, res);
if (cb) cb(null, resBody, res);
});

@@ -60,3 +59,3 @@ };

default:
cb("Invalid / unknown address protocol. (Expected HTTP or HTTPS.)", null, null);
if (cb) cb("Invalid / unknown address protocol. (Expected HTTP or HTTPS.)", null, null);
return;

@@ -66,3 +65,3 @@ }

req.on("error", (err) => {
cb(err, null, null);
if (cb) cb(err, null, null);
});

@@ -69,0 +68,0 @@

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

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

@@ -17,3 +17,3 @@ # phin

p("https://www.ony.io", function(err, body, response) {
p("https://www.ony.io", (err, body, response) => {
if (!err) console.log(body);

@@ -41,3 +41,3 @@ });

}
})
});
```

@@ -55,3 +55,3 @@

})
}, function(err, body, response) {
}, (err, body, response) => {
if (!err) console.log("Sent data!");

@@ -67,3 +67,3 @@ });

"auth": "ethan:letmein"
}, function(err, body, response) {
}, (err, body, response) => {
if (!err) console.log(body);

@@ -78,3 +78,3 @@ });

"url": "https://ethan:letmein@ony.io:8080"
}, function(err, body, response) {
}, (err, body, response) => {
if (!err) console.log(body);

@@ -91,3 +91,3 @@ });

* `options` **required** - {} - object containing request options OR string URL to send GET request to
* `options` **required** - __Object or String__ - object containing request options OR string URL to send GET request to
* `url` **required** - _String_ - URL to request (Can include port, auth. These will be used if their respective options are not present.)

@@ -99,3 +99,3 @@ * `method` - _String_ - Default: `'GET'` - Request method. Ex. `'GET'`

* `auth` - _String_ - Authorization in `'user:pass'` format
* `callback` **required** - function(err, body, response) {} - callback method
* `callback` - (err, body, response) {} - callback method
* `err` - _String_ / null - Is null if no error occurs during request.

@@ -102,0 +102,0 @@ * `body` - _String_ - Response content

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