Tungsten v0.1.0 Tungsten.CDP.Fetch View Source
A domain for letting clients substitute browser's network layer with client code.
Link to this section Summary
Link to this section Types
cdp_auth_challenge_response_type() View Source
Response to an AuthChallenge.
cdp_auth_challenge_type() View Source
Authorization challenge for HTTP status code 401 or 407.
cdp_header_entry_type() View Source
Response HTTP header entry
cdp_request_id_type()
View Source
cdp_request_id_type() :: String.t()
cdp_request_id_type() :: String.t()
Unique request identifier.
cdp_request_pattern_type()
View Source
cdp_request_pattern_type() :: %{
optional(:url_pattern) => String.t(),
optional(:resource_type) => Tungsten.CDP.Network.cdp_resource_type_type(),
optional(:request_stage) => cdp_request_stage_type()
}
cdp_request_pattern_type() :: %{
optional(:url_pattern) => String.t(),
optional(:resource_type) => Tungsten.CDP.Network.cdp_resource_type_type(),
optional(:request_stage) => cdp_request_stage_type()
}
This type has no documentation
cdp_request_stage_type()
View Source
cdp_request_stage_type() :: :response | :request
cdp_request_stage_type() :: :response | :request
Stages of the request to handle. Request will intercept before the request is sent. Response will intercept after the response is received (but before response body is received.
Link to this section Functions
continue_request(session, parameters, options \\ [])
View Source
continue_request(
GenServer.server(),
%{
:request_id => cdp_request_id_type(),
optional(:url) => String.t(),
optional(:method) => String.t(),
optional(:post_data) => String.t(),
optional(:headers) => [cdp_header_entry_type()]
},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
continue_request( GenServer.server(), %{ :request_id => cdp_request_id_type(), optional(:url) => String.t(), optional(:method) => String.t(), optional(:post_data) => String.t(), optional(:headers) => [cdp_header_entry_type()] }, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Continues the request, optionally modifying some of its parameters.
continue_with_auth(session, parameters, options \\ [])
View Source
continue_with_auth(
GenServer.server(),
%{
request_id: cdp_request_id_type(),
auth_challenge_response: cdp_auth_challenge_response_type()
},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
continue_with_auth( GenServer.server(), %{ request_id: cdp_request_id_type(), auth_challenge_response: cdp_auth_challenge_response_type() }, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Continues a request supplying authChallengeResponse following authRequired event.
disable(session, parameters \\ %{}, options \\ [])
View Source
disable(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
{:ok, map()} | {:error, term()}
disable(GenServer.server(), map(), Tungsten.Connection.exec_options()) :: {:ok, map()} | {:error, term()}
Disables the fetch domain.
enable(session, parameters \\ %{}, options \\ [])
View Source
enable(
GenServer.server(),
%{
optional(:patterns) => [cdp_request_pattern_type()],
optional(:handle_auth_requests) => boolean()
},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
enable( GenServer.server(), %{ optional(:patterns) => [cdp_request_pattern_type()], optional(:handle_auth_requests) => boolean() }, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Enables issuing of requestPaused events. A request will be paused until client calls one of failRequest, fulfillRequest or continueRequest/continueWithAuth.
fail_request(session, parameters, options \\ [])
View Source
fail_request(
GenServer.server(),
%{
request_id: cdp_request_id_type(),
error_reason: Tungsten.CDP.Network.cdp_error_reason_type()
},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
fail_request( GenServer.server(), %{ request_id: cdp_request_id_type(), error_reason: Tungsten.CDP.Network.cdp_error_reason_type() }, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Causes the request to fail with specified reason.
fulfill_request(session, parameters, options \\ [])
View Source
fulfill_request(
GenServer.server(),
%{
:request_id => cdp_request_id_type(),
:response_code => integer(),
:response_headers => [cdp_header_entry_type()],
optional(:body) => String.t(),
optional(:response_phrase) => String.t()
},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
fulfill_request( GenServer.server(), %{ :request_id => cdp_request_id_type(), :response_code => integer(), :response_headers => [cdp_header_entry_type()], optional(:body) => String.t(), optional(:response_phrase) => String.t() }, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Provides response to the request.
get_response_body(session, parameters, options \\ [])
View Source
get_response_body(
GenServer.server(),
%{request_id: cdp_request_id_type()},
Tungsten.Connection.exec_options()
) :: {:ok, %{body: String.t(), base64_encoded: boolean()}} | {:error, term()}
get_response_body( GenServer.server(), %{request_id: cdp_request_id_type()}, Tungsten.Connection.exec_options() ) :: {:ok, %{body: String.t(), base64_encoded: boolean()}} | {:error, term()}
Causes the body of the response to be received from the server and returned as a single string. May only be issued for a request that is paused in the Response stage and is mutually exclusive with takeResponseBodyForInterceptionAsStream. Calling other methods that affect the request or disabling fetch domain before body is received results in an undefined behavior.
take_response_body_as_stream(session, parameters, options \\ [])
View Source
take_response_body_as_stream(
GenServer.server(),
%{request_id: cdp_request_id_type()},
Tungsten.Connection.exec_options()
) ::
{:ok, %{stream: Tungsten.CDP.IO.cdp_stream_handle_type()}} | {:error, term()}
take_response_body_as_stream( GenServer.server(), %{request_id: cdp_request_id_type()}, Tungsten.Connection.exec_options() ) :: {:ok, %{stream: Tungsten.CDP.IO.cdp_stream_handle_type()}} | {:error, term()}
Fetch.takeResponseBodyAsStream
Returns a handle to the stream representing the response body. The request must be paused in the HeadersReceived stage. Note that after this command the request can't be continued as is -- client either needs to cancel it or to provide the response body. The stream only supports sequential read, IO.read will fail if the position is specified. This method is mutually exclusive with getResponseBody. Calling other methods that affect the request or disabling fetch domain before body is received results in an undefined behavior.