diff --git a/README.md b/README.md
index 751231f..6389c15 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
> Wumpfetch - A fast and easy to use HTTP client
@@ -46,15 +46,17 @@ const w = require('wumpfetch');
// Using an URL and custom options
;(async() => {
let req = await w('https://aws.random.cat/meow', {
+ chaining: false,
headers: {
'User-Agent': 'Project/0.0.1'
}
});
// Only URL
- req = await w('https://aws.random.cat/meow');
+ req = await w('https://aws.random.cat/meow', { chaining: false });
// Only options
req = await w({
url: 'https://aws.random.cat/meow',
+ chaining: false,
headers: {
'User-Agent': 'Project/0.0.1'
}
@@ -76,7 +78,7 @@ You can also chain methods by adding `chaining: true` to `options`
const w = require('wumpfetch');
;(async() => {
- const r = await w('https://my-site.com/postboi', { method: 'POST', chaining: true })
+ const r = await w('https://my-site.com/postboi', { method: 'POST' })
.timeout(1000) // Set a 1s timeout
.query('video', 'wumpboye') // Add a query
.header({ 'Authorization': 'Pablito' }) // Set a header
diff --git a/__test__/main.js b/__test__/main.js
index 8110d35..1a399a0 100644
--- a/__test__/main.js
+++ b/__test__/main.js
@@ -5,8 +5,8 @@ console.log(`Using wumpfetch v${wump.version} [${wump.userAgent}]\n\n`);
;(async() => {
const requests = [
- await wump({ url: 'https://jsonplaceholder.typicode.com/todos/1', parse: 'json', chaining: true }).send(),
- await wump('https://jsonplaceholder.typicode.com/todos/1')
+ await wump({ url: 'https://jsonplaceholder.typicode.com/todos/1', parse: 'json' }).send(),
+ await wump('https://jsonplaceholder.typicode.com/todos/1', { chaining: false })
];
console.log(`Test 1: \n${util.inspect(requests[0].body)}\n\n`);
diff --git a/lib/model/WumpRequest.js b/lib/model/WumpRequest.js
index e52cef9..87e836f 100644
--- a/lib/model/WumpRequest.js
+++ b/lib/model/WumpRequest.js
@@ -24,7 +24,7 @@ module.exports = class WumpRequest {
'SDA': obj && typeof o.sendDataAs === 'string' ? o.sendDataAs : obj && o.data && typeof o.data === 'object' ? 'json' : undefined,
'data': obj && o.body ? o.body : obj && o.data ? o.data : obj && o.json ? o.json : obj && o.form ? qs.stringify(o.form) : undefined,
'parse': obj && o.parse ? o.parse : undefined,
- 'chain': !!(obj && o.chaining),
+ 'chain': obj && typeof o.chaining === 'boolean' ? o.chaining : true,
'follow': !!(obj && o.followRedirects),
'rHeaders': obj && typeof o.headers === 'object' ? o.headers : {},
'streamed': !!(obj && o.streamed),