Skip to content

Commit 21570be

Browse files
committed
Fail fast if the UTL is not HTTP in ChromeDPClient
Resolves: #465
1 parent 2094ade commit 21570be

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/commonMain/kotlin/org/hildan/chrome/devtools/protocol/ChromeDPClient.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ class ChromeDPClient(
7676
*/
7777
private val httpClient: HttpClient = if (overrideHostHeader) DEFAULT_HTTP_CLIENT_WITH_HOST_OVERRIDE else DEFAULT_HTTP_CLIENT,
7878
) {
79+
init {
80+
require(remoteDebugUrl.startsWith("http://") || remoteDebugUrl.startsWith("https://")) {
81+
"This function is meant to be used with 'http://' or 'https://' URLs, but got $remoteDebugUrl. " +
82+
"If you already have a web socket URL, use ChromeDP.connect(wsUrl) directly instead."
83+
}
84+
}
85+
7986
/**
8087
* Fetches the browser version metadata via the debugger's HTTP API.
8188
*/

0 commit comments

Comments
 (0)