SIGN IN SIGN UP

fix(realtime): preserve base URL queries in WebSocket upgrades (#3971)

A custom base URL such as https://example.test/v1/customer?tenant=sample
failed to open Realtime WebSockets. Both the base URL normalization and
sync/async Realtime path preparation appended to HTTPX's raw_path, which
includes the query. As a result, the server received /v1/customer
instead of /v1/customer/realtime.

Append the slash and endpoint before the existing query, preserving the
original query and connection options. Four real WebSocket tests verify
the path, authentication and header overrides, configured compression,
outbound messages, same-connection recovery after an API error, unknown
fields and clean close.

Validation:
- Before: both query-bearing tests failed, both plain-URL cases passed.
- After: 149 affected Realtime/WebSocket/HTTPX/redirect/region tests and
12 client base URL tests passed under each of Pydantic 1 and 2. All four
final tests passed on both.
- Full Ruff, mypy and Pyright passed.

No new API or schema changes. Shared base URL normalization also applies
to HTTP clients; broader HTTP relative-query behavior is outside this
change.
M
Mark Stuart committed
f7bd4a703cad904e4f5d91ec9d7abac70d8c0bd6
Parent: 43443d1
Committed by GitHub <noreply@github.com> on 9/27/2026, 6:55:24 PM