@@ -6,11 +6,11 @@ defmodule ChromeRemoteInterface.HTTP do
6
6
@type success_http_response :: {:ok, Map.t()}
7
7
@type error_http_response :: {:error, any()}
8
8
9
- @spec call(ChromeRemoteInterface.Server.t(), String.t()) ::
9
+ @spec call(ChromeRemoteInterface.Server.t(), String.t(), [] ) ::
10
10
success_http_response | error_http_response
11
- def call(server, path) do
11
+ def call(server, path, opts \\ [] ) do
12
12
server
13
- |> execute_request(path)
13
+ |> execute_request(path, opts )
14
14
|> handle_response()
15
15
end
16
16
@@ -22,8 +22,9 @@ defmodule ChromeRemoteInterface.HTTP do
22
22
"http://#{server.host}:#{server.port}#{path}"
23
23
end
24
24
25
- defp execute_request(server, path) do
26
- :hackney.request(:get, http_url(server, path), [], <<>>, path_encode_fun: & &1)
25
+ defp execute_request(server, path, opts \\ []) do
26
+ verb = opts[:verb] || :get
27
+ :hackney.request(verb, http_url(server, path), [], <<>>, path_encode_fun: & &1)
27
28
end
28
29
29
30
defp handle_response({:ok, status_code, _response_headers, client_ref}) do
0 commit comments