Skip to content

Commit 1130645

Browse files
authored
fix(browser-vm): fakeFetch method input type judge (#580)
1 parent 94544a3 commit 1130645

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/browser-vm/src/modules/network.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function networkModule(sandbox: Sandbox) {
3737

3838
const url = arguments[1];
3939

40-
if(sandbox.options.addSourceList){
40+
if (sandbox.options.addSourceList) {
4141
sandbox.options.addSourceList({
4242
tagName: 'xmlhttprequest',
4343
url,
@@ -73,8 +73,11 @@ export function networkModule(sandbox: Sandbox) {
7373
if (needFix(input) && baseUrl) {
7474
input = transformUrl(baseUrl, input);
7575
}
76-
if(sandbox.options.addSourceList){
77-
sandbox.options.addSourceList({ tagName: 'fetch', url: input });
76+
if (sandbox.options.addSourceList) {
77+
sandbox.options.addSourceList({
78+
tagName: 'fetch',
79+
url: input instanceof Request ? input.url : input,
80+
});
7881
}
7982
let controller;
8083
if (!hasOwn(options, 'signal') && window.AbortController) {

0 commit comments

Comments
 (0)