From d67699b899eea8e80330fe78c1e1ea99f7f2d2e8 Mon Sep 17 00:00:00 2001 From: chickliu Date: Mon, 8 Dec 2025 18:10:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20js/nfsq.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/nfsq.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 });