httpApi

fun httpApi(httpUrl: String, overrideHostHeader: Boolean = false, configureClient: HttpClientConfig<*>.() -> Unit): ChromeDPHttpApi(source)

Creates a client that uses Chrome's JSON HTTP endpoints to query metadata about the browser or the protocol, and to list, create and close targets (e.g. tabs).

Avoid using the returned ChromeDPHttpApi to manage targets (list/open/close tabs). Not all headless browsers support these endpoints, and they are superseded by the web socket API. Prefer the web socket API by using connect instead.

Parameters

httpUrl

the remote debugger's HTTP URL (not web socket). It should be something like http://localhost:9222.

overrideHostHeader

Overrides the Host header in HTTP requests to localhost, and restores the original host in the URLs returned by Chrome's endpoints. Chrome doesn't accept a Host header that is not an IP nor localhost, but in some environments the URL has to have a named host (e.g. docker services in a docker swarm, communicating using service names).

configureClient

Adds extra configuration to the default HttpClient used to interact with the Chrome HTTP API.


fun httpApi(httpUrl: String, overrideHostHeader: Boolean = false, httpClient: HttpClient = defaultHttpClient): ChromeDPHttpApi(source)

Creates a client that uses Chrome's JSON HTTP endpoints to query metadata about the browser or the protocol, and to list, create and close targets (e.g. tabs).

Avoid using the returned ChromeDPHttpApi to manage targets (list/open/close tabs). Not all headless browsers support these endpoints, and they are superseded by the web socket API. Prefer the web socket API by using connect instead.

Parameters

httpUrl

the remote debugger's HTTP URL (not web socket). It should be something like http://localhost:9222.

overrideHostHeader

Overrides the Host header in HTTP requests to localhost, and restores the original host in the URLs returned by Chrome's endpoints. Chrome doesn't accept a Host header that is not an IP nor localhost, but in some environments the URL has to have a named host (e.g. docker services in a docker swarm, communicating using service names).

httpClient

the Ktor client to use to interact with the Chrome HTTP API.