mirror of
https://github.com/daief/gm-response-proxy.git
synced 2026-05-03 03:29:34 +08:00
wip: support fetch
This commit is contained in:
@@ -16,7 +16,7 @@ function proxyRes(response: Response) {
|
||||
|
||||
if (res) {
|
||||
GM_log(
|
||||
`❗️ Response is proxyed:\n`,
|
||||
`❗️ [fetch] Response is proxyed:\n`,
|
||||
`${payload?.method || ''} ${response.url}\n`,
|
||||
safeParse(res)
|
||||
);
|
||||
@@ -33,6 +33,9 @@ if (typeof Response !== 'undefined') {
|
||||
try {
|
||||
return JSON.parse(res);
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
`❌ Error when parse proxy response for [${this.url}]. Use original result.`
|
||||
);
|
||||
return nativeRes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ XMLHttpRequest.prototype.send = function (
|
||||
this.responseText = matchedRule.response;
|
||||
|
||||
GM_log(
|
||||
`❗️ Response is proxyed:\n`,
|
||||
`❗️ [XHR] Response is proxyed:\n`,
|
||||
`${payload.method} ${payload.url}\n`,
|
||||
safeParse(matchedRule.response)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user