GM XHR header处理
Some checks failed
test / Run tests (push) Failing after 11s
build / Build (push) Failing after 23s
Some checks failed
test / Run tests (push) Failing after 11s
build / Build (push) Failing after 23s
This commit is contained in:
@ -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());
|
||||
};
|
||||
|
Reference in New Issue
Block a user