Comparing version 3.2.2 to 3.2.3
@@ -9,3 +9,4 @@ "use strict"; | ||
events = require("events"), | ||
EventEmitter = events.EventEmitter; | ||
EventEmitter = events.EventEmitter, | ||
assured = require("assured"); | ||
@@ -46,4 +47,5 @@ /** | ||
var _done = false; | ||
// Unique callback | ||
var opt_callback = function opt_callback(err, data, res) { | ||
var opt_callback = assured(function (err, data, res) { | ||
if (_done) { | ||
@@ -57,3 +59,3 @@ return; | ||
callback(err, data, res); | ||
}; | ||
}); | ||
@@ -104,3 +106,5 @@ // Handle post data | ||
request.end(); | ||
str.then = opt_callback._.then.bind(opt_callback._); | ||
str.catch = opt_callback._.catch.bind(opt_callback._); | ||
return str; | ||
}; |
{ | ||
"name": "tinyreq", | ||
"version": "3.2.2", | ||
"version": "3.2.3", | ||
"description": "Tiny library for making http(s) requests.", | ||
@@ -30,2 +30,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"assured": "^1.0.6", | ||
"follow-redirects": "^0.2.0", | ||
@@ -32,0 +33,0 @@ "ul": "^5.0.0" |
@@ -0,1 +1,2 @@ | ||
<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. --> | ||
@@ -32,2 +33,3 @@ [](#) | ||
// Make a request with custom headers | ||
// Using a promise | ||
tinyreq({ | ||
@@ -38,7 +40,11 @@ url: "http://example.com/" | ||
} | ||
}, (err, body) => { | ||
console.log(err || body); | ||
}).then(body => { | ||
console.log(body); | ||
}).catch(err => { | ||
console.log(err); | ||
}); | ||
``` | ||
## :question: Get Help | ||
@@ -50,3 +56,3 @@ | ||
2. For bug reports and feature requests, open issues. :bug: | ||
3. For direct and quick help from me, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket: | ||
3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket: | ||
@@ -61,2 +67,3 @@ | ||
#### Params | ||
- **String|Object** `options`: A string being the request url or an object containing the following fields: | ||
@@ -106,3 +113,3 @@ - `url` (String): The request url. | ||
- [`lwipify`](https://github.com/IonicaBizau/lwipify#readme)—Convert images in lwip objects. | ||
- [`mun`](https://github.com/theuves/mun#readme) (by Matheus Alves)—Obter algumas informações de qualquer município do Brasil. | ||
- [`mun`](https://github.com/theuves/mun#readme) (by Matheus Alves)—Obter informações de municípios do brasileiros. | ||
- [`page-changed`](https://github.com/IonicaBizau/node-page-changed)—Call a function when the page body is changed. | ||
@@ -109,0 +116,0 @@ - [`tibia-api`](https://github.com/Ethaan/nodejs-tibia-api#readme) (by Ethaan)—NodeJS Tibia.com API |
Sorry, the diff of this file is too big to display
118625
1691
132
3
+ Addedassured@^1.0.6
+ Addedassured@1.0.16(transitive)
+ Addedsliced@1.0.1(transitive)