mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-19 07:19:45 +02:00
Better default request names
This commit is contained in:
@@ -782,10 +782,15 @@ function defaultRequestName(r: HttpRequest): string | null {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fixedUrl = r.url.match(/^https?:\/\//) ? r.url : 'http://' + r.url;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const url = new URL(r.url);
|
const url = new URL(fixedUrl);
|
||||||
return url.pathname != '/' ? url.host + url.pathname : url.host;
|
const pathname = url.pathname === '/' ? '' : url.pathname;
|
||||||
|
return `${url.host}${pathname}`;
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return r.url;
|
// Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user