clj-chrome-devtools.commands.fetch
A domain for letting clients substitute browser’s network layer with client code.
continue-request
(continue-request)
(continue-request {:as params, :keys [request-id url method post-data headers intercept-response]})
(continue-request connection {:as params, :keys [request-id url method post-data headers intercept-response]})
Continues the request, optionally modifying some of its parameters.
Parameters map keys:
Key | Description |
---|---|
:request-id | An id the client received in requestPaused event. |
:url | If set, the request url will be modified in a way that’s not observable by page. (optional) |
:method | If set, the request method is overridden. (optional) |
:post-data | If set, overrides the post data in the request. (Encoded as a base64 string when passed over JSON) (optional) |
:headers | If set, overrides the request headers. (optional) |
:intercept-response | If set, overrides response interception behavior for this request. (optional) |
continue-response
(continue-response)
(continue-response {:as params, :keys [request-id response-code response-phrase response-headers binary-response-headers]})
(continue-response connection {:as params, :keys [request-id response-code response-phrase response-headers binary-response-headers]})
Continues loading of the paused response, optionally modifying the response headers. If either responseCode or headers are modified, all of them must be present.
Parameters map keys:
Key | Description |
---|---|
:request-id | An id the client received in requestPaused event. |
:response-code | An HTTP response code. If absent, original response code will be used. (optional) |
:response-phrase | A textual representation of responseCode. |
If absent, a standard phrase matching responseCode is used. (optional) :response-headers | Response headers. If absent, original response headers will be used. (optional) :binary-response-headers | Alternative way of specifying response headers as a \0-separated series of name: value pairs. Prefer the above method unless you need to represent some non-UTF8 values that can’t be transmitted over the protocol as text. (Encoded as a base64 string when passed over JSON) (optional)
continue-with-auth
(continue-with-auth)
(continue-with-auth {:as params, :keys [request-id auth-challenge-response]})
(continue-with-auth connection {:as params, :keys [request-id auth-challenge-response]})
Continues a request supplying authChallengeResponse following authRequired event.
Parameters map keys:
Key | Description |
---|---|
:request-id | An id the client received in authRequired event. |
:auth-challenge-response | Response to with an authChallenge. |
disable
(disable)
(disable {:as params, :keys []})
(disable connection {:as params, :keys []})
Disables the fetch domain.
enable
(enable)
(enable {:as params, :keys [patterns handle-auth-requests]})
(enable connection {:as params, :keys [patterns handle-auth-requests]})
Enables issuing of requestPaused events. A request will be paused until client calls one of failRequest, fulfillRequest or continueRequest/continueWithAuth.
Parameters map keys:
Key | Description |
---|---|
:patterns | If specified, only requests matching any of these patterns will produce |
fetchRequested event and will be paused until clients response. If not set, all requests will be affected. (optional) :handle-auth-requests | If true, authRequired events will be issued and requests will be paused expecting a call to continueWithAuth. (optional)
fail-request
(fail-request)
(fail-request {:as params, :keys [request-id error-reason]})
(fail-request connection {:as params, :keys [request-id error-reason]})
Causes the request to fail with specified reason.
Parameters map keys:
Key | Description |
---|---|
:request-id | An id the client received in requestPaused event. |
:error-reason | Causes the request to fail with the given reason. |
fulfill-request
(fulfill-request)
(fulfill-request {:as params, :keys [request-id response-code response-headers binary-response-headers body response-phrase]})
(fulfill-request connection {:as params, :keys [request-id response-code response-headers binary-response-headers body response-phrase]})
Provides response to the request.
Parameters map keys:
Key | Description |
---|---|
:request-id | An id the client received in requestPaused event. |
:response-code | An HTTP response code. |
:response-headers | Response headers. (optional) |
:binary-response-headers | Alternative way of specifying response headers as a \0-separated |
series of name: value pairs. Prefer the above method unless you need to represent some non-UTF8 values that can’t be transmitted over the protocol as text. (Encoded as a base64 string when passed over JSON) (optional) :body | A response body. If absent, original response body will be used if the request is intercepted at the response stage and empty body will be used if the request is intercepted at the request stage. (Encoded as a base64 string when passed over JSON) (optional) :response-phrase | A textual representation of responseCode. If absent, a standard phrase matching responseCode is used. (optional)
get-response-body
(get-response-body)
(get-response-body {:as params, :keys [request-id]})
(get-response-body connection {:as params, :keys [request-id]})
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.
Parameters map keys:
Key | Description |
---|---|
:request-id | Identifier for the intercepted request to get body for. |
Return map keys:
Key | Description |
---|---|
:body | Response body. |
:base64-encoded | True, if content was sent as base64. |
take-response-body-as-stream
(take-response-body-as-stream)
(take-response-body-as-stream {:as params, :keys [request-id]})
(take-response-body-as-stream connection {:as params, :keys [request-id]})
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.
Parameters map keys:
Key | Description |
---|---|
:request-id | null |
Return map keys:
Key | Description |
---|---|
:stream | null |