更新 js/nfsq.js
This commit is contained in:
parent
be0faf654f
commit
d67699b899
@ -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 });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user