mirror of
https://github.com/movie-web/extension.git
synced 2025-09-13 09:03:25 +00:00
always create dynamic rule for fetch request
This commit is contained in:
@@ -52,13 +52,11 @@ const handler: PlasmoMessaging.MessageHandler<Request, Response<any>> = async (r
|
|||||||
const url = makeFullUrl(req.body.url, req.body);
|
const url = makeFullUrl(req.body.url, req.body);
|
||||||
await assertDomainWhitelist(req.sender.tab.url);
|
await assertDomainWhitelist(req.sender.tab.url);
|
||||||
|
|
||||||
if (Object.keys(req.body.headers).length > 0) {
|
await setDynamicRules({
|
||||||
await setDynamicRules({
|
ruleId: MAKE_REQUEST_DYNAMIC_RULE,
|
||||||
ruleId: MAKE_REQUEST_DYNAMIC_RULE,
|
targetDomains: [new URL(url).hostname],
|
||||||
targetDomains: [new URL(url).hostname],
|
requestHeaders: req.body.headers,
|
||||||
requestHeaders: req.body.headers,
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: req.body.method,
|
method: req.body.method,
|
||||||
|
Reference in New Issue
Block a user