fix: correct websocket_base_url derivation to preserve http in query params#3301
fix: correct websocket_base_url derivation to preserve http in query params#3301AliSharjeell wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a52297ef13
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| self.webhook_secret = webhook_secret | ||
|
|
||
| self.websocket_base_url = websocket_base_url | ||
| self._websocket_base_url = websocket_base_url |
There was a problem hiding this comment.
Restore AsyncOpenAI.websocket_base_url attribute
Assigning only self._websocket_base_url here removes the public websocket_base_url instance attribute on AsyncOpenAI, but async websocket code still reads self.__client.websocket_base_url (for example in src/openai/resources/realtime/realtime.py and src/openai/resources/responses/responses.py). Because AsyncOpenAI has no corresponding property, those accesses now raise AttributeError at runtime for async clients, breaking realtime/response streaming flows.
Useful? React with 👍 / 👎.
Summary
websocket_base_urlfrom a simple attribute to a propertybase_urlby only replacing the scheme prefixFix
When
websocket_base_urlis not explicitly set, it is now derived frombase_urlusing httpx.URL's copy_with method, which only changes the scheme component rather than doing string replacement.Test
Verified that URLs with http:// in query parameters are handled correctly.
Closes #3294