fix: misc bugs

This commit is contained in:
Percs 2024-11-26 23:10:44 -06:00
parent 58fed66f78
commit ca3e09af8e
8 changed files with 20 additions and 28 deletions

View file

@ -9,7 +9,7 @@ export default function (client: ScramjetClient, _self: typeof globalThis) {
client.Proxy("fetch", {
apply(ctx) {
if (typeof ctx.args[0] === "string" || ctx.args[0] instanceof URL) {
ctx.args[0] = rewriteUrl(ctx.args[0].toString(), client.meta);
ctx.args[0] = rewriteUrl(ctx.args[0], client.meta);
if (isemulatedsw) ctx.args[0] += "?from=swruntime";
}
@ -19,7 +19,7 @@ export default function (client: ScramjetClient, _self: typeof globalThis) {
client.Proxy("Request", {
construct(ctx) {
if (typeof ctx.args[0] === "string" || ctx.args[0] instanceof URL) {
ctx.args[0] = rewriteUrl(ctx.args[0].toString(), client.meta);
ctx.args[0] = rewriteUrl(ctx.args[0], client.meta);
if (isemulatedsw) ctx.args[0] += "?from=swruntime";
}

View file

@ -50,6 +50,10 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
binaryType: "blob",
barews,
onclose: null,
onerror: null,
onmessage: null,
onopen: null,
captureListeners: {},
listeners: {},
};