diff --git a/js/nfsq.js b/js/nfsq.js index f71de30..6068a4d 100644 --- a/js/nfsq.js +++ b/js/nfsq.js @@ -478,7 +478,9 @@ function Env(name) { const that = this; return { get: (opts) => that.sendReq('GET', opts), - post: (opts) => that.sendReq('POST', opts) + post: (opts) => that.sendReq('POST', opts), + put: (opts) => that.sendReq('PUT', opts), + delete: (opts) => that.sendReq('DELETE', opts) } } sendReq(method, opts) { @@ -490,7 +492,7 @@ function Env(name) { } else if ("undefined" != typeof $task) { $task.fetch(reqOpts).then(res => resolve({ body: res.body, headers: res.headers })).catch(reject); } else if ("undefined" != typeof $httpClient) { - const client = method === 'POST' ? $httpClient.post : $httpClient.get; + const client = method === 'POST' ? $httpClient.post : (method === 'PUT' ? $httpClient.put : $httpClient.get); client(reqOpts, (err, res, body) => { if (err) reject(err); else resolve({ body: body, headers: res.headers });