mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 13:01:14 +00:00
refactor: webapi http
This commit is contained in:
parent
8fe7d3aaec
commit
7ecd479b3e
@ -61,7 +61,12 @@ export class RequestUtil {
|
|||||||
requestInit.headers = new Headers(headers);
|
requestInit.headers = new Headers(headers);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const response = await fetch(url, { ...requestInit, body: data });
|
let response;
|
||||||
|
if (method.toUpperCase() === 'POST') {
|
||||||
|
response = await fetch(url, { ...requestInit, body: data });
|
||||||
|
} else {
|
||||||
|
response = await fetch(url, { ...requestInit });
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
}
|
}
|
||||||
|
2
src/core
2
src/core
@ -1 +1 @@
|
|||||||
Subproject commit d06dd4d66ca4d50c70ce066cd872edb939138d34
|
Subproject commit f88118be512b1ed1537b2aad1f183c04858e1d70
|
Loading…
Reference in New Issue
Block a user