/
event.go
55 lines (49 loc) · 3.34 KB
/
event.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Code generated by cdpgen. DO NOT EDIT.
package fetch
import (
"github.com/mafredri/cdp/protocol/network"
"github.com/mafredri/cdp/protocol/page"
"github.com/mafredri/cdp/rpcc"
)
// RequestPausedClient is a client for RequestPaused events. 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.
type RequestPausedClient interface {
// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
// triggered, context canceled or connection closed.
Recv() (*RequestPausedReply, error)
rpcc.Stream
}
// RequestPausedReply is the reply for RequestPaused events.
type RequestPausedReply 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 page.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 *int `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 *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.
}
// AuthRequiredClient is a client for AuthRequired events. Issued when the
// domain is enabled with handleAuthRequests set to true. The request is paused
// until client responds with continueWithAuth.
type AuthRequiredClient interface {
// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
// triggered, context canceled or connection closed.
Recv() (*AuthRequiredReply, error)
rpcc.Stream
}
// AuthRequiredReply is the reply for AuthRequired events.
type AuthRequiredReply 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 page.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.
}