Comparing version 2.2.0 to 2.2.1
@@ -15,2 +15,3 @@ "use strict"; | ||
* @property {string} [method=GET] - Request method ('GET', 'POST', etc.) | ||
* @property {string|Object} [data] - Data to send as request body (if Object, data is JSON.stringified unless content-type header is present and set to 'application/x-www-url-form-encoded' in which case the data will be encoded as a query string.) | ||
* @property {Object} [headers={}] - Request headers | ||
@@ -116,3 +117,3 @@ * @property {string} [auth=autodetect] - Request authentiction in "user:password" format | ||
const contentType = options.headers["Content-Type"] || options.headers["content-type"]; | ||
if (contentType === "x/www-url-form-encoded") { | ||
if (contentType === "application/x-www-url-form-encoded") { | ||
postData = qs.stringify(opts.data); | ||
@@ -119,0 +120,0 @@ } else { |
{ | ||
"name": "phin", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Ultra-simple, lightweight, dependency-free Node.JS HTTP request client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,3 +12,3 @@ # phin | ||
## Simple Usage | ||
For a simple GET request. | ||
For a simple page GET request. | ||
@@ -18,4 +18,4 @@ ```javascript | ||
p("https://www.ony.io", (err, res) => { | ||
if (!err) console.log(res.body); | ||
p("https://www.github.com/FuturisticCake", (err, res) => { | ||
if (!err) console.log(res.body.toString()); | ||
}); | ||
@@ -32,3 +32,3 @@ ``` | ||
## Demonstrations | ||
## Quick Demos | ||
@@ -39,3 +39,3 @@ ### GET request with added headers | ||
p({ | ||
"url": "https://ony.io", | ||
"url": "https://www.github.com/FuturisticCake", | ||
"headers": { | ||
@@ -51,3 +51,3 @@ "User-Agent": "phin" | ||
p({ | ||
"url": "https://ony.io", | ||
"url": "https://www.github.com/FuturisticCake", | ||
"method": "POST", | ||
@@ -60,3 +60,3 @@ "port": 8080, | ||
"headers": { | ||
"Content-Type" : "application/json" // or x/www-url-form-encoded if you want "data" encoded as a query string | ||
"Content-Type" : "application/json" | ||
} | ||
@@ -72,3 +72,3 @@ }, (err, res) => { | ||
p({ | ||
"url": "https://ony.io:8080", | ||
"url": "https://example.com", | ||
"auth": "ethan:letmein" | ||
@@ -84,3 +84,3 @@ }, (err, res) => { | ||
p({ | ||
"url": "https://ethan:letmein@ony.io:8080" | ||
"url": "https://ethan:letmein@example.com:8080" | ||
}, (err, res) => { | ||
@@ -87,0 +87,0 @@ if (!err) console.log(res.body); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1049158
822