api/url: replace user-agent argument with headers in redirect helpers

This commit is contained in:
Felix Vuong 🍂
2025-03-29 20:11:56 +07:00
committed by jj
parent b1bde25dee
commit a6240d0192
4 changed files with 11 additions and 20 deletions

View File

@@ -239,11 +239,11 @@ export function extract(url) {
return { host, patternMatch };
}
export async function resolveRedirectingURL(url, dispatcher, userAgent) {
export async function resolveRedirectingURL(url, dispatcher, headers) {
const originalService = getHostIfValid(normalizeURL(url));
if (!originalService) return;
const canonicalURL = await getRedirectingURL(url, dispatcher, userAgent);
const canonicalURL = await getRedirectingURL(url, dispatcher, headers);
if (!canonicalURL) return;
const { host, patternMatch } = extract(normalizeURL(canonicalURL));