← Back to PRs

#13325: (feat)Normalize to pass WebSocket CDP URLs for Browser

by snekkenull open 2026-02-10 10:35 View on GitHub →
size: XS
Add support for remote browser CDP which using WS protocol by normalize ws/wss → http/https so callers can pass WebSocket CDP URLs. <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR enables users to pass WebSocket CDP URLs (`ws://`, `wss://`) as browser configuration, automatically normalizing them to HTTP/HTTPS for REST endpoint access. The normalization converts `ws:` → `http:` and `wss:` → `https:` in two locations: `parseHttpUrl()` in `src/browser/config.ts:96-106` and `parseBaseUrl()` in `src/browser/extension-relay.ts:117-138`. **Changes:** - Updated `parseHttpUrl()` and `parseBaseUrl()` to accept and normalize WebSocket protocols - Added comprehensive test coverage for ws/wss URL normalization - Updated error messages to reflect that ws(s) protocols are now accepted - Changed test fixture from `ws://` to `ftp://` for unsupported protocol validation The approach aligns with existing normalization patterns in the codebase (see `normalizeCdpHttpBaseForJsonEndpoints` in `src/browser/pw-session.ts:529-549`). <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - The implementation is clean, follows existing patterns in the codebase, includes comprehensive test coverage for both ws and wss protocols, and correctly updates error messages. The normalization approach is consistent with similar logic already present in `pw-session.ts`. - No files require special attention <sub>Last reviewed commit: 3ce0867</sub> <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs