fetch

package
v0.0.0-...-ab6d619 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 10 Imported by: 67

Documentation

Overview

Package fetch provides the Chrome DevTools Protocol commands, types, and events for the Fetch domain.

A domain for letting clients substitute browser's network layer with client code.

Generated by the cdproto-gen command.

Index

Constants

View Source
const (
	CommandDisable                  = "Fetch.disable"
	CommandEnable                   = "Fetch.enable"
	CommandFailRequest              = "Fetch.failRequest"
	CommandFulfillRequest           = "Fetch.fulfillRequest"
	CommandContinueRequest          = "Fetch.continueRequest"
	CommandContinueWithAuth         = "Fetch.continueWithAuth"
	CommandContinueResponse         = "Fetch.continueResponse"
	CommandGetResponseBody          = "Fetch.getResponseBody"
	CommandTakeResponseBodyAsStream = "Fetch.takeResponseBodyAsStream"
)

Command names.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthChallenge

type AuthChallenge struct {
	Source AuthChallengeSource `json:"source,omitempty"` // Source of the authentication challenge.
	Origin string              `json:"origin"`           // Origin of the challenger.
	Scheme string              `json:"scheme"`           // The authentication scheme used, such as basic or digest
	Realm  string              `json:"realm"`            // The realm of the challenge. May be empty.
}

AuthChallenge authorization challenge for HTTP status code 401 or 407.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-AuthChallenge

func (AuthChallenge) MarshalEasyJSON

func (v AuthChallenge) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AuthChallenge) MarshalJSON

func (v AuthChallenge) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AuthChallenge) UnmarshalEasyJSON

func (v *AuthChallenge) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AuthChallenge) UnmarshalJSON

func (v *AuthChallenge) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AuthChallengeResponse

type AuthChallengeResponse struct {
	Response AuthChallengeResponseResponse `json:"response"`           // 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.
	Username string                        `json:"username,omitempty"` // The username to provide, possibly empty. Should only be set if response is ProvideCredentials.
	Password string                        `json:"password,omitempty"` // The password to provide, possibly empty. Should only be set if response is ProvideCredentials.
}

AuthChallengeResponse response to an AuthChallenge.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-AuthChallengeResponse

func (AuthChallengeResponse) MarshalEasyJSON

func (v AuthChallengeResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AuthChallengeResponse) MarshalJSON

func (v AuthChallengeResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AuthChallengeResponse) UnmarshalEasyJSON

func (v *AuthChallengeResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AuthChallengeResponse) UnmarshalJSON

func (v *AuthChallengeResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AuthChallengeResponseResponse

type AuthChallengeResponseResponse string

AuthChallengeResponseResponse 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.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-AuthChallengeResponse

const (
	AuthChallengeResponseResponseDefault            AuthChallengeResponseResponse = "Default"
	AuthChallengeResponseResponseCancelAuth         AuthChallengeResponseResponse = "CancelAuth"
	AuthChallengeResponseResponseProvideCredentials AuthChallengeResponseResponse = "ProvideCredentials"
)

AuthChallengeResponseResponse values.

func (AuthChallengeResponseResponse) MarshalEasyJSON

func (t AuthChallengeResponseResponse) MarshalEasyJSON(out *jwriter.Writer)

MarshalEasyJSON satisfies easyjson.Marshaler.

func (AuthChallengeResponseResponse) MarshalJSON

func (t AuthChallengeResponseResponse) MarshalJSON() ([]byte, error)

MarshalJSON satisfies json.Marshaler.

func (AuthChallengeResponseResponse) String

String returns the AuthChallengeResponseResponse as string value.

func (*AuthChallengeResponseResponse) UnmarshalEasyJSON

func (t *AuthChallengeResponseResponse) UnmarshalEasyJSON(in *jlexer.Lexer)

UnmarshalEasyJSON satisfies easyjson.Unmarshaler.

func (*AuthChallengeResponseResponse) UnmarshalJSON

func (t *AuthChallengeResponseResponse) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies json.Unmarshaler.

type AuthChallengeSource

type AuthChallengeSource string

AuthChallengeSource source of the authentication challenge.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-AuthChallenge

const (
	AuthChallengeSourceServer AuthChallengeSource = "Server"
	AuthChallengeSourceProxy  AuthChallengeSource = "Proxy"
)

AuthChallengeSource values.

func (AuthChallengeSource) MarshalEasyJSON

func (t AuthChallengeSource) MarshalEasyJSON(out *jwriter.Writer)

MarshalEasyJSON satisfies easyjson.Marshaler.

func (AuthChallengeSource) MarshalJSON

func (t AuthChallengeSource) MarshalJSON() ([]byte, error)

MarshalJSON satisfies json.Marshaler.

func (AuthChallengeSource) String

func (t AuthChallengeSource) String() string

String returns the AuthChallengeSource as string value.

func (*AuthChallengeSource) UnmarshalEasyJSON

func (t *AuthChallengeSource) UnmarshalEasyJSON(in *jlexer.Lexer)

UnmarshalEasyJSON satisfies easyjson.Unmarshaler.

func (*AuthChallengeSource) UnmarshalJSON

func (t *AuthChallengeSource) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies json.Unmarshaler.

type ContinueRequestParams

type ContinueRequestParams struct {
	RequestID         RequestID      `json:"requestId"`                   // An id the client received in requestPaused event.
	URL               string         `json:"url,omitempty"`               // If set, the request url will be modified in a way that's not observable by page.
	Method            string         `json:"method,omitempty"`            // If set, the request method is overridden.
	PostData          string         `json:"postData,omitempty"`          // If set, overrides the post data in the request.
	Headers           []*HeaderEntry `json:"headers,omitempty"`           // If set, overrides the request headers. Note that the overrides do not extend to subsequent redirect hops, if a redirect happens. Another override may be applied to a different request produced by a redirect.
	InterceptResponse bool           `json:"interceptResponse,omitempty"` // If set, overrides response interception behavior for this request.
}

ContinueRequestParams continues the request, optionally modifying some of its parameters.

func ContinueRequest

func ContinueRequest(requestID RequestID) *ContinueRequestParams

ContinueRequest continues the request, optionally modifying some of its parameters.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-continueRequest

parameters:

requestID - An id the client received in requestPaused event.

func (*ContinueRequestParams) Do

func (p *ContinueRequestParams) Do(ctx context.Context) (err error)

Do executes Fetch.continueRequest against the provided context.

func (ContinueRequestParams) MarshalEasyJSON

func (v ContinueRequestParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ContinueRequestParams) MarshalJSON

func (v ContinueRequestParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ContinueRequestParams) UnmarshalEasyJSON

func (v *ContinueRequestParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ContinueRequestParams) UnmarshalJSON

func (v *ContinueRequestParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (ContinueRequestParams) WithHeaders

func (p ContinueRequestParams) WithHeaders(headers []*HeaderEntry) *ContinueRequestParams

WithHeaders if set, overrides the request headers. Note that the overrides do not extend to subsequent redirect hops, if a redirect happens. Another override may be applied to a different request produced by a redirect.

func (ContinueRequestParams) WithInterceptResponse

func (p ContinueRequestParams) WithInterceptResponse(interceptResponse bool) *ContinueRequestParams

WithInterceptResponse if set, overrides response interception behavior for this request.

func (ContinueRequestParams) WithMethod

func (p ContinueRequestParams) WithMethod(method string) *ContinueRequestParams

WithMethod if set, the request method is overridden.

func (ContinueRequestParams) WithPostData

func (p ContinueRequestParams) WithPostData(postData string) *ContinueRequestParams

WithPostData if set, overrides the post data in the request.

func (ContinueRequestParams) WithURL

WithURL if set, the request url will be modified in a way that's not observable by page.

type ContinueResponseParams

type ContinueResponseParams struct {
	RequestID             RequestID      `json:"requestId"`                       // An id the client received in requestPaused event.
	ResponseCode          int64          `json:"responseCode,omitempty"`          // An HTTP response code. If absent, original response code will be used.
	ResponsePhrase        string         `json:"responsePhrase,omitempty"`        // A textual representation of responseCode. If absent, a standard phrase matching responseCode is used.
	ResponseHeaders       []*HeaderEntry `json:"responseHeaders,omitempty"`       // Response headers. If absent, original response headers will be used.
	BinaryResponseHeaders string         `json:"binaryResponseHeaders,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.
}

ContinueResponseParams continues loading of the paused response, optionally modifying the response headers. If either responseCode or headers are modified, all of them must be present.

func ContinueResponse

func ContinueResponse(requestID RequestID) *ContinueResponseParams

ContinueResponse continues loading of the paused response, optionally modifying the response headers. If either responseCode or headers are modified, all of them must be present.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-continueResponse

parameters:

requestID - An id the client received in requestPaused event.

func (*ContinueResponseParams) Do

func (p *ContinueResponseParams) Do(ctx context.Context) (err error)

Do executes Fetch.continueResponse against the provided context.

func (ContinueResponseParams) MarshalEasyJSON

func (v ContinueResponseParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ContinueResponseParams) MarshalJSON

func (v ContinueResponseParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ContinueResponseParams) UnmarshalEasyJSON

func (v *ContinueResponseParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ContinueResponseParams) UnmarshalJSON

func (v *ContinueResponseParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (ContinueResponseParams) WithBinaryResponseHeaders

func (p ContinueResponseParams) WithBinaryResponseHeaders(binaryResponseHeaders string) *ContinueResponseParams

WithBinaryResponseHeaders 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.

func (ContinueResponseParams) WithResponseCode

func (p ContinueResponseParams) WithResponseCode(responseCode int64) *ContinueResponseParams

WithResponseCode an HTTP response code. If absent, original response code will be used.

func (ContinueResponseParams) WithResponseHeaders

func (p ContinueResponseParams) WithResponseHeaders(responseHeaders []*HeaderEntry) *ContinueResponseParams

WithResponseHeaders response headers. If absent, original response headers will be used.

func (ContinueResponseParams) WithResponsePhrase

func (p ContinueResponseParams) WithResponsePhrase(responsePhrase string) *ContinueResponseParams

WithResponsePhrase a textual representation of responseCode. If absent, a standard phrase matching responseCode is used.

type ContinueWithAuthParams

type ContinueWithAuthParams struct {
	RequestID             RequestID              `json:"requestId"`             // An id the client received in authRequired event.
	AuthChallengeResponse *AuthChallengeResponse `json:"authChallengeResponse"` // Response to  with an authChallenge.
}

ContinueWithAuthParams continues a request supplying authChallengeResponse following authRequired event.

func ContinueWithAuth

func ContinueWithAuth(requestID RequestID, authChallengeResponse *AuthChallengeResponse) *ContinueWithAuthParams

ContinueWithAuth continues a request supplying authChallengeResponse following authRequired event.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-continueWithAuth

parameters:

requestID - An id the client received in authRequired event.
authChallengeResponse - Response to  with an authChallenge.

func (*ContinueWithAuthParams) Do

func (p *ContinueWithAuthParams) Do(ctx context.Context) (err error)

Do executes Fetch.continueWithAuth against the provided context.

func (ContinueWithAuthParams) MarshalEasyJSON

func (v ContinueWithAuthParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ContinueWithAuthParams) MarshalJSON

func (v ContinueWithAuthParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ContinueWithAuthParams) UnmarshalEasyJSON

func (v *ContinueWithAuthParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ContinueWithAuthParams) UnmarshalJSON

func (v *ContinueWithAuthParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type DisableParams

type DisableParams struct{}

DisableParams disables the fetch domain.

func Disable

func Disable() *DisableParams

Disable disables the fetch domain.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-disable

func (*DisableParams) Do

func (p *DisableParams) Do(ctx context.Context) (err error)

Do executes Fetch.disable against the provided context.

func (DisableParams) MarshalEasyJSON

func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (DisableParams) MarshalJSON

func (v DisableParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*DisableParams) UnmarshalEasyJSON

func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*DisableParams) UnmarshalJSON

func (v *DisableParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type EnableParams

type EnableParams struct {
	Patterns           []*RequestPattern `json:"patterns,omitempty"`           // 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.
	HandleAuthRequests bool              `json:"handleAuthRequests,omitempty"` // If true, authRequired events will be issued and requests will be paused expecting a call to continueWithAuth.
}

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

func Enable

func Enable() *EnableParams

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

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-enable

parameters:

func (*EnableParams) Do

func (p *EnableParams) Do(ctx context.Context) (err error)

Do executes Fetch.enable against the provided context.

func (EnableParams) MarshalEasyJSON

func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (EnableParams) MarshalJSON

func (v EnableParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*EnableParams) UnmarshalEasyJSON

func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*EnableParams) UnmarshalJSON

func (v *EnableParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (EnableParams) WithHandleAuthRequests

func (p EnableParams) WithHandleAuthRequests(handleAuthRequests bool) *EnableParams

WithHandleAuthRequests if true, authRequired events will be issued and requests will be paused expecting a call to continueWithAuth.

func (EnableParams) WithPatterns

func (p EnableParams) WithPatterns(patterns []*RequestPattern) *EnableParams

WithPatterns 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.

type EventAuthRequired

type EventAuthRequired struct {
	RequestID     RequestID            `json:"requestId"`     // Each request the page makes will have a unique id.
	Request       *network.Request     `json:"request"`       // The details of the request.
	FrameID       cdp.FrameID          `json:"frameId"`       // The id of the frame that initiated the request.
	ResourceType  network.ResourceType `json:"resourceType"`  // How the requested resource will be used.
	AuthChallenge *AuthChallenge       `json:"authChallenge"` // Details of the Authorization Challenge encountered. If this is set, client should respond with continueRequest that contains AuthChallengeResponse.
}

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

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#event-authRequired

func (EventAuthRequired) MarshalEasyJSON

func (v EventAuthRequired) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (EventAuthRequired) MarshalJSON

func (v EventAuthRequired) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*EventAuthRequired) UnmarshalEasyJSON

func (v *EventAuthRequired) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*EventAuthRequired) UnmarshalJSON

func (v *EventAuthRequired) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type EventRequestPaused

type EventRequestPaused struct {
	RequestID           RequestID            `json:"requestId"`                     // Each request the page makes will have a unique id.
	Request             *network.Request     `json:"request"`                       // The details of the request.
	FrameID             cdp.FrameID          `json:"frameId"`                       // The id of the frame that initiated the request.
	ResourceType        network.ResourceType `json:"resourceType"`                  // How the requested resource will be used.
	ResponseErrorReason network.ErrorReason  `json:"responseErrorReason,omitempty"` // Response error if intercepted at response stage.
	ResponseStatusCode  int64                `json:"responseStatusCode,omitempty"`  // Response code if intercepted at response stage.
	ResponseStatusText  string               `json:"responseStatusText,omitempty"`  // Response status text if intercepted at response stage.
	ResponseHeaders     []*HeaderEntry       `json:"responseHeaders,omitempty"`     // Response headers if intercepted at the response stage.
	NetworkID           network.RequestID    `json:"networkId,omitempty"`           // 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.
	RedirectedRequestID RequestID            `json:"redirectedRequestId,omitempty"` // If the request is due to a redirect response from the server, the id of the request that has caused the redirect.
}

EventRequestPaused 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. Redirect responses and subsequent requests are reported similarly to regular responses and requests. Redirect responses may be distinguished by the value of responseStatusCode (which is one of 301, 302, 303, 307, 308) along with presence of the location header. Requests resulting from a redirect will have redirectedRequestId field set.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#event-requestPaused

func (EventRequestPaused) MarshalEasyJSON

func (v EventRequestPaused) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (EventRequestPaused) MarshalJSON

func (v EventRequestPaused) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*EventRequestPaused) UnmarshalEasyJSON

func (v *EventRequestPaused) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*EventRequestPaused) UnmarshalJSON

func (v *EventRequestPaused) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type FailRequestParams

type FailRequestParams struct {
	RequestID   RequestID           `json:"requestId"`   // An id the client received in requestPaused event.
	ErrorReason network.ErrorReason `json:"errorReason"` // Causes the request to fail with the given reason.
}

FailRequestParams causes the request to fail with specified reason.

func FailRequest

func FailRequest(requestID RequestID, errorReason network.ErrorReason) *FailRequestParams

FailRequest causes the request to fail with specified reason.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-failRequest

parameters:

requestID - An id the client received in requestPaused event.
errorReason - Causes the request to fail with the given reason.

func (*FailRequestParams) Do

func (p *FailRequestParams) Do(ctx context.Context) (err error)

Do executes Fetch.failRequest against the provided context.

func (FailRequestParams) MarshalEasyJSON

func (v FailRequestParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FailRequestParams) MarshalJSON

func (v FailRequestParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FailRequestParams) UnmarshalEasyJSON

func (v *FailRequestParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FailRequestParams) UnmarshalJSON

func (v *FailRequestParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type FulfillRequestParams

type FulfillRequestParams struct {
	RequestID             RequestID      `json:"requestId"`                       // An id the client received in requestPaused event.
	ResponseCode          int64          `json:"responseCode"`                    // An HTTP response code.
	ResponseHeaders       []*HeaderEntry `json:"responseHeaders,omitempty"`       // Response headers.
	BinaryResponseHeaders string         `json:"binaryResponseHeaders,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.
	Body                  string         `json:"body,omitempty"`                  // 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.
	ResponsePhrase        string         `json:"responsePhrase,omitempty"`        // A textual representation of responseCode. If absent, a standard phrase matching responseCode is used.
}

FulfillRequestParams provides response to the request.

func FulfillRequest

func FulfillRequest(requestID RequestID, responseCode int64) *FulfillRequestParams

FulfillRequest provides response to the request.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-fulfillRequest

parameters:

requestID - An id the client received in requestPaused event.
responseCode - An HTTP response code.

func (*FulfillRequestParams) Do

func (p *FulfillRequestParams) Do(ctx context.Context) (err error)

Do executes Fetch.fulfillRequest against the provided context.

func (FulfillRequestParams) MarshalEasyJSON

func (v FulfillRequestParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FulfillRequestParams) MarshalJSON

func (v FulfillRequestParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FulfillRequestParams) UnmarshalEasyJSON

func (v *FulfillRequestParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FulfillRequestParams) UnmarshalJSON

func (v *FulfillRequestParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (FulfillRequestParams) WithBinaryResponseHeaders

func (p FulfillRequestParams) WithBinaryResponseHeaders(binaryResponseHeaders string) *FulfillRequestParams

WithBinaryResponseHeaders 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.

func (FulfillRequestParams) WithBody

WithBody 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.

func (FulfillRequestParams) WithResponseHeaders

func (p FulfillRequestParams) WithResponseHeaders(responseHeaders []*HeaderEntry) *FulfillRequestParams

WithResponseHeaders response headers.

func (FulfillRequestParams) WithResponsePhrase

func (p FulfillRequestParams) WithResponsePhrase(responsePhrase string) *FulfillRequestParams

WithResponsePhrase a textual representation of responseCode. If absent, a standard phrase matching responseCode is used.

type GetResponseBodyParams

type GetResponseBodyParams struct {
	RequestID RequestID `json:"requestId"` // Identifier for the intercepted request to get body for.
}

GetResponseBodyParams 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. Note that the response body is not available for redirects. Requests paused in the _redirect received_ state may be differentiated by responseCode and presence of location response header, see comments to requestPaused for details.

func GetResponseBody

func GetResponseBody(requestID RequestID) *GetResponseBodyParams

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. Note that the response body is not available for redirects. Requests paused in the _redirect received_ state may be differentiated by responseCode and presence of location response header, see comments to requestPaused for details.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-getResponseBody

parameters:

requestID - Identifier for the intercepted request to get body for.

func (*GetResponseBodyParams) Do

func (p *GetResponseBodyParams) Do(ctx context.Context) (body []byte, err error)

Do executes Fetch.getResponseBody against the provided context.

returns:

body - Response body.

func (GetResponseBodyParams) MarshalEasyJSON

func (v GetResponseBodyParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (GetResponseBodyParams) MarshalJSON

func (v GetResponseBodyParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*GetResponseBodyParams) UnmarshalEasyJSON

func (v *GetResponseBodyParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*GetResponseBodyParams) UnmarshalJSON

func (v *GetResponseBodyParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type GetResponseBodyReturns

type GetResponseBodyReturns struct {
	Body          string `json:"body,omitempty"`          // Response body.
	Base64encoded bool   `json:"base64Encoded,omitempty"` // True, if content was sent as base64.
}

GetResponseBodyReturns return values.

func (GetResponseBodyReturns) MarshalEasyJSON

func (v GetResponseBodyReturns) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (GetResponseBodyReturns) MarshalJSON

func (v GetResponseBodyReturns) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*GetResponseBodyReturns) UnmarshalEasyJSON

func (v *GetResponseBodyReturns) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*GetResponseBodyReturns) UnmarshalJSON

func (v *GetResponseBodyReturns) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type HeaderEntry

type HeaderEntry struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

HeaderEntry response HTTP header entry.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-HeaderEntry

func (HeaderEntry) MarshalEasyJSON

func (v HeaderEntry) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (HeaderEntry) MarshalJSON

func (v HeaderEntry) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*HeaderEntry) UnmarshalEasyJSON

func (v *HeaderEntry) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*HeaderEntry) UnmarshalJSON

func (v *HeaderEntry) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type RequestID

type RequestID string

RequestID unique request identifier.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-RequestId

func (RequestID) String

func (t RequestID) String() string

String returns the RequestID as string value.

type RequestPattern

type RequestPattern struct {
	URLPattern   string               `json:"urlPattern,omitempty"`   // Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is backslash. Omitting is equivalent to "*".
	ResourceType network.ResourceType `json:"resourceType,omitempty"` // If set, only requests for matching resource types will be intercepted.
	RequestStage RequestStage         `json:"requestStage,omitempty"` // Stage at which to begin intercepting requests. Default is Request.
}

RequestPattern [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-RequestPattern

func (RequestPattern) MarshalEasyJSON

func (v RequestPattern) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (RequestPattern) MarshalJSON

func (v RequestPattern) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*RequestPattern) UnmarshalEasyJSON

func (v *RequestPattern) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*RequestPattern) UnmarshalJSON

func (v *RequestPattern) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type RequestStage

type RequestStage string

RequestStage 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).

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-RequestStage

const (
	RequestStageRequest  RequestStage = "Request"
	RequestStageResponse RequestStage = "Response"
)

RequestStage values.

func (RequestStage) MarshalEasyJSON

func (t RequestStage) MarshalEasyJSON(out *jwriter.Writer)

MarshalEasyJSON satisfies easyjson.Marshaler.

func (RequestStage) MarshalJSON

func (t RequestStage) MarshalJSON() ([]byte, error)

MarshalJSON satisfies json.Marshaler.

func (RequestStage) String

func (t RequestStage) String() string

String returns the RequestStage as string value.

func (*RequestStage) UnmarshalEasyJSON

func (t *RequestStage) UnmarshalEasyJSON(in *jlexer.Lexer)

UnmarshalEasyJSON satisfies easyjson.Unmarshaler.

func (*RequestStage) UnmarshalJSON

func (t *RequestStage) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies json.Unmarshaler.

type TakeResponseBodyAsStreamParams

type TakeResponseBodyAsStreamParams struct {
	RequestID RequestID `json:"requestId"`
}

TakeResponseBodyAsStreamParams 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.

func TakeResponseBodyAsStream

func TakeResponseBodyAsStream(requestID RequestID) *TakeResponseBodyAsStreamParams

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.

See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-takeResponseBodyAsStream

parameters:

requestID

func (*TakeResponseBodyAsStreamParams) Do

Do executes Fetch.takeResponseBodyAsStream against the provided context.

returns:

stream

func (TakeResponseBodyAsStreamParams) MarshalEasyJSON

func (v TakeResponseBodyAsStreamParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TakeResponseBodyAsStreamParams) MarshalJSON

func (v TakeResponseBodyAsStreamParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TakeResponseBodyAsStreamParams) UnmarshalEasyJSON

func (v *TakeResponseBodyAsStreamParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TakeResponseBodyAsStreamParams) UnmarshalJSON

func (v *TakeResponseBodyAsStreamParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TakeResponseBodyAsStreamReturns

type TakeResponseBodyAsStreamReturns struct {
	Stream io.StreamHandle `json:"stream,omitempty"`
}

TakeResponseBodyAsStreamReturns return values.

func (TakeResponseBodyAsStreamReturns) MarshalEasyJSON

func (v TakeResponseBodyAsStreamReturns) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TakeResponseBodyAsStreamReturns) MarshalJSON

func (v TakeResponseBodyAsStreamReturns) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TakeResponseBodyAsStreamReturns) UnmarshalEasyJSON

func (v *TakeResponseBodyAsStreamReturns) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TakeResponseBodyAsStreamReturns) UnmarshalJSON

func (v *TakeResponseBodyAsStreamReturns) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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