mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-06-04 11:13:59 +08:00
chore: Change network request method
This commit is contained in:
parent
a1ba4e273e
commit
b46209e164
25
backend/src/vendor/open-api.js
vendored
25
backend/src/vendor/open-api.js
vendored
@ -376,25 +376,16 @@ export function HTTP(defaultOptions = { baseURL: '' }) {
|
||||
});
|
||||
} else if (isGUIforCores) {
|
||||
worker = new Promise(async (resolve, reject) => {
|
||||
const requestHandler = {
|
||||
get: $Plugins.HttpGet,
|
||||
head: $Plugins.HttpHead,
|
||||
post: $Plugins.HttpPost,
|
||||
put: $Plugins.HttpPut,
|
||||
delete: $Plugins.HttpDelete,
|
||||
};
|
||||
const request = requestHandler[method.toLowerCase()];
|
||||
if (!request)
|
||||
reject(
|
||||
'[GUI.for.Cores] This method is not implemented: ' +
|
||||
method,
|
||||
);
|
||||
try {
|
||||
const { url, headers } = options;
|
||||
const response = await request(url, headers, options.body);
|
||||
const response = await $Plugins.Requests({
|
||||
method,
|
||||
url: options.url,
|
||||
headers: options.headers,
|
||||
body: options.body,
|
||||
});
|
||||
resolve({
|
||||
statusCode: response.status ?? 200,
|
||||
headers: response.header,
|
||||
statusCode: response.status,
|
||||
headers: response.headers,
|
||||
body: response.body,
|
||||
});
|
||||
} catch (error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user