feature(worker+api): improve buffer

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-09-17 23:37:11 +02:00
parent 32e91959f6
commit 545cbfd520
18 changed files with 1484 additions and 432 deletions

View File

@@ -22,12 +22,13 @@ export function parsePath(path?: string): {
}
try {
const url = new URL(path);
const hasOrigin = path.startsWith('http');
const url = new URL(path, hasOrigin ? undefined : 'http://localhost');
return {
query: parseSearchParams(url.searchParams),
path: url.pathname,
hash: url.hash || undefined,
origin: url.origin,
origin: hasOrigin ? url.origin : '',
};
} catch (error) {
return {