fix(websocket): forward URL credentials as Authorization header

Merged
RO
10mo ago
+234-4

Summary

  • Extracts credentials from WebSocket URL (ws://user:pass@host) and sends them as Basic Authorization header
  • User-provided Authorization header takes precedence over URL credentials
  • Credentials are properly URL-decoded before being Base64-encoded

Fixes #24388

Test plan

  • Added regression test test/regression/issue/24388.test.ts with 5 test cases:
    • Basic credentials in URL
    • Empty password
    • No credentials (no header sent)
    • Custom Authorization header takes precedence
    • Special characters (URL-encoded) in credentials
  • Tests pass with bun bd test test/regression/issue/24388.test.ts
  • Tests fail with USE_SYSTEM_BUN=1 bun test (confirming the bug existed)

šŸ¤– Generated with Claude Code