GM XHR header处理
Some checks failed
test / Run tests (push) Failing after 11s
build / Build (push) Failing after 23s

This commit is contained in:
2025-03-11 17:50:46 +08:00
parent 6d983ed0e4
commit 99e33c18f6
3 changed files with 46 additions and 26 deletions

View File

@ -7,6 +7,12 @@ export class GMApi {
console.log(params);
const xhr = new XMLHttpRequest();
xhr.open(params.method || "GET", params.url);
// 添加header
if (params.headers) {
for (const key in params.headers) {
xhr.setRequestHeader(key, params.headers[key]);
}
}
xhr.onload = function () {
console.log(xhr, xhr.getAllResponseHeaders());
};