From 3010a1da9a324ee2d6294bb7afcebb43c41b271f Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 27 Oct 2019 14:41:48 +0100 Subject: [PATCH] fix(core): update --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 37b6097..c928a7c 100644 --- a/README.md +++ b/README.md @@ -46,23 +46,24 @@ let options: smartrequest.ISmartRequestOptions = { // typed options "Content-Type": "application/json" "Authorization": "Bearer token" }, - requestBody: { + requestBody: JSON.stringify({ key1: 'value1', key2: 3 - } + }) } -smartrequest.post('https://example.com', options).then(res => { +smartrequest.request('https://example.com', options).then(res => { console.log(res.status) console.log(res.body) // if json, body will be parsed automatically }).catch(err => { console.log(err) }) -// also available -smartrequest.get(...) -smartrequest.put(...) -smartrequest.del(...) +// dedicated JSON metods are available: +smartrequest.getJson(...) +smartrequest.postJson(...) +smartrequest.putJson(...) +smartrequest.delJson(...) // streaming smartrequest.get('https://example.com/bigfile.mp4', optionsArg, true).then(res => { // third arg = true signals streaming