Files
boc/node_modules/http-proxy-middleware/dist/utils/create-url.js
T
Bernt 6989a98d75 feat: Passwordless cross-device authentication
- Arkitektur: docs/auth/passwordless-architecture.md
- Backend: iom/quixzoom-auth-service/ (FastAPI + Redis)
- Webb: quixzoom-market-pages/se/login/ (QR-kod + polling)
- App: iom/quixzoom-app/src/features/auth/ (push + deep links)

Flöde: QR-kod → app-godkännande → webb-inloggad
2026-07-07 07:11:50 +00:00

18 lines
670 B
JavaScript

import { URL } from 'url';
export function createUrl({ protocol, host, port, path }) {
// wrap IPv6 host in brackets
const ipv6Host = host?.includes(':') ? `[${host}]` : host;
// use fallback values to create a valid URL (protocol: 'undefined:', host: '[::]')
// nock v13 issue: protocol and host are undefined (https://github.com/chimurai/http-proxy-middleware/issues/1035)
// nock v14+ seems to return protocol and host correctly
const base = `${protocol || 'undefined:'}//${ipv6Host || '[::]'}`;
const url = new URL(base);
if (port) {
url.port = port;
}
if (path) {
url.pathname = path;
}
return url;
}