fetch

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const AuthRequiredEvent = "Fetch.authRequired"

Issued when the domain is enabled with handleAuthRequests set to true. The request is paused until client responds with continueWithAuth.

View Source
const ContinueRequest = "Fetch.continueRequest"

Continues the request, optionally modifying some of its parameters.

View Source
const ContinueWithAuth = "Fetch.continueWithAuth"

Continues a request supplying authChallengeResponse following authRequired event.

View Source
const Disable = "Fetch.disable"

Disables the fetch domain.

View Source
const Enable = "Fetch.enable"

Enables issuing of requestPaused events. A request will be paused until client calls one of failRequest, fulfillRequest or continueRequest/continueWithAuth.

View Source
const FailRequest = "Fetch.failRequest"

Causes the request to fail with specified reason.

View Source
const FulfillRequest = "Fetch.fulfillRequest"

Provides response to the request.

View Source
const GetResponseBody = "Fetch.getResponseBody"

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.

View Source
const RequestPausedEvent = "Fetch.requestPaused"

Issued when the domain is enabled and the request URL matches the specified filter. The request is paused until the client responds with one of continueRequest, failRequest or fulfillRequest. The stage of the request can be determined by presence of responseErrorReason and responseStatusCode -- the request is at the response stage if either of these fields is present and in the request stage otherwise.

View Source
const TakeResponseBodyAsStream = "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.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthChallenge

type AuthChallenge struct {

	// Source of the authentication challenge.
	Source string `json:"source,omitempty"`

	// Origin of the challenger.
	Origin string `json:"origin"`

	// The authentication scheme used, such as basic or digest
	Scheme string `json:"scheme"`

	// The realm of the challenge. May be empty.
	Realm string `json:"realm"`
}

Authorization challenge for HTTP status code 401 or 407.

type AuthChallengeResponse

type AuthChallengeResponse struct {

	// The decision on what to do in response to the authorization challenge.  Default means
	// deferring to the default behavior of the net stack, which will likely either the Cancel
	// authentication or display a popup dialog box.
	Response string `json:"response"`

	// The username to provide, possibly empty. Should only be set if response is
	// ProvideCredentials.
	Username string `json:"username,omitempty"`

	// The password to provide, possibly empty. Should only be set if response is
	// ProvideCredentials.
	Password string `json:"password,omitempty"`
}

Response to an AuthChallenge.

type AuthRequiredParams

type AuthRequiredParams struct {

	// Each request the page makes will have a unique id.
	RequestId RequestId
	// The details of the request.
	Request network.Request
	// The id of the frame that initiated the request.
	FrameId cdp.FrameId
	// How the requested resource will be used.
	ResourceType network.ResourceType
	// Details of the Authorization Challenge encountered.
	// If this is set, client should respond with continueRequest that
	// contains AuthChallengeResponse.
	AuthChallenge AuthChallenge
}

type ContinueRequestParams

type ContinueRequestParams struct {

	// An id the client received in requestPaused event.
	RequestId RequestId `json:"requestId"`

	// If set, the request url will be modified in a way that's not observable by page.
	Url string `json:"url,omitempty"`

	// If set, the request method is overridden.
	Method string `json:"method,omitempty"`

	// If set, overrides the post data in the request.
	PostData string `json:"postData,omitempty"`

	// If set, overrides the request headrts.
	Headers []*HeaderEntry `json:"headers,omitempty"`
}

type ContinueRequestResult

type ContinueRequestResult struct {
}

type ContinueWithAuthParams

type ContinueWithAuthParams struct {

	// An id the client received in authRequired event.
	RequestId RequestId `json:"requestId"`

	// Response to  with an authChallenge.
	AuthChallengeResponse AuthChallengeResponse `json:"authChallengeResponse"`
}

type ContinueWithAuthResult

type ContinueWithAuthResult struct {
}

type DisableParams

type DisableParams struct {
}

type DisableResult

type DisableResult struct {
}

type EnableParams

type EnableParams struct {

	// 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.
	Patterns []*RequestPattern `json:"patterns,omitempty"`

	// If true, authRequired events will be issued and requests will be paused
	// expecting a call to continueWithAuth.
	HandleAuthRequests bool `json:"handleAuthRequests,omitempty"`
}

type EnableResult

type EnableResult struct {
}

type FailRequestParams

type FailRequestParams struct {

	// An id the client received in requestPaused event.
	RequestId RequestId `json:"requestId"`

	// Causes the request to fail with the given reason.
	ErrorReason network.ErrorReason `json:"errorReason"`
}

type FailRequestResult

type FailRequestResult struct {
}

type FulfillRequestParams

type FulfillRequestParams struct {

	// An id the client received in requestPaused event.
	RequestId RequestId `json:"requestId"`

	// An HTTP response code.
	ResponseCode int `json:"responseCode"`

	// Response headers.
	ResponseHeaders []*HeaderEntry `json:"responseHeaders,omitempty"`

	// 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.
	BinaryResponseHeaders []byte `json:"binaryResponseHeaders,omitempty"`

	// A response body.
	Body []byte `json:"body,omitempty"`

	// A textual representation of responseCode.
	// If absent, a standard phrase matching responseCode is used.
	ResponsePhrase string `json:"responsePhrase,omitempty"`
}

type FulfillRequestResult

type FulfillRequestResult struct {
}

type GetResponseBodyParams

type GetResponseBodyParams struct {

	// Identifier for the intercepted request to get body for.
	RequestId RequestId `json:"requestId"`
}

type GetResponseBodyResult

type GetResponseBodyResult struct {

	// Response body.
	Body string `json:"body"`
	// True, if content was sent as base64.
	Base64Encoded bool `json:"base64Encoded"`
}

type HeaderEntry

type HeaderEntry struct {

	//
	Name string `json:"name"`

	//
	Value string `json:"value"`
}

Response HTTP header entry

type RequestId

type RequestId string

Unique request identifier.

type RequestPattern

type RequestPattern struct {

	// Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is
	// backslash. Omitting is equivalent to "*".
	UrlPattern string `json:"urlPattern,omitempty"`

	// If set, only requests for matching resource types will be intercepted.
	ResourceType network.ResourceType `json:"resourceType,omitempty"`

	// Stage at wich to begin intercepting requests. Default is Request.
	RequestStage RequestStage `json:"requestStage,omitempty"`
}

type RequestPausedParams

type RequestPausedParams struct {

	// Each request the page makes will have a unique id.
	RequestId RequestId
	// The details of the request.
	Request network.Request
	// The id of the frame that initiated the request.
	FrameId cdp.FrameId
	// How the requested resource will be used.
	ResourceType network.ResourceType
	// Response error if intercepted at response stage.
	ResponseErrorReason network.ErrorReason
	// Response code if intercepted at response stage.
	ResponseStatusCode int
	// Response headers if intercepted at the response stage.
	ResponseHeaders []*HeaderEntry
	// If the intercepted request had a corresponding Network.requestWillBeSent event fired for it,
	// then this networkId will be the same as the requestId present in the requestWillBeSent event.
	NetworkId RequestId
}

type RequestStage

type RequestStage string

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.

type TakeResponseBodyAsStreamParams

type TakeResponseBodyAsStreamParams struct {

	//
	RequestId RequestId `json:"requestId"`
}

type TakeResponseBodyAsStreamResult

type TakeResponseBodyAsStreamResult struct {

	//
	Stream io.StreamHandle `json:"stream"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL