Updating to latest protocol.json
This commit is contained in:
parent
d2a7882b93
commit
91303cba34
|
@ -156,6 +156,7 @@ const (
|
|||
EventNetworkWebSocketFrameError MethodType = "Network.webSocketFrameError"
|
||||
EventNetworkWebSocketFrameSent MethodType = "Network.webSocketFrameSent"
|
||||
EventNetworkEventSourceMessageReceived MethodType = "Network.eventSourceMessageReceived"
|
||||
EventNetworkRequestIntercepted MethodType = "Network.requestIntercepted"
|
||||
CommandNetworkEnable MethodType = "Network.enable"
|
||||
CommandNetworkDisable MethodType = "Network.disable"
|
||||
CommandNetworkSetUserAgentOverride MethodType = "Network.setUserAgentOverride"
|
||||
|
@ -177,6 +178,8 @@ const (
|
|||
CommandNetworkSetBypassServiceWorker MethodType = "Network.setBypassServiceWorker"
|
||||
CommandNetworkSetDataSizeLimitsForTest MethodType = "Network.setDataSizeLimitsForTest"
|
||||
CommandNetworkGetCertificate MethodType = "Network.getCertificate"
|
||||
CommandNetworkEnableRequestInterception MethodType = "Network.enableRequestInterception"
|
||||
CommandNetworkContinueInterceptedRequest MethodType = "Network.continueInterceptedRequest"
|
||||
EventDatabaseAddDatabase MethodType = "Database.addDatabase"
|
||||
CommandDatabaseEnable MethodType = "Database.enable"
|
||||
CommandDatabaseDisable MethodType = "Database.disable"
|
||||
|
@ -694,6 +697,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
*t = EventNetworkWebSocketFrameSent
|
||||
case EventNetworkEventSourceMessageReceived:
|
||||
*t = EventNetworkEventSourceMessageReceived
|
||||
case EventNetworkRequestIntercepted:
|
||||
*t = EventNetworkRequestIntercepted
|
||||
case CommandNetworkEnable:
|
||||
*t = CommandNetworkEnable
|
||||
case CommandNetworkDisable:
|
||||
|
@ -736,6 +741,10 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
*t = CommandNetworkSetDataSizeLimitsForTest
|
||||
case CommandNetworkGetCertificate:
|
||||
*t = CommandNetworkGetCertificate
|
||||
case CommandNetworkEnableRequestInterception:
|
||||
*t = CommandNetworkEnableRequestInterception
|
||||
case CommandNetworkContinueInterceptedRequest:
|
||||
*t = CommandNetworkContinueInterceptedRequest
|
||||
case EventDatabaseAddDatabase:
|
||||
*t = EventDatabaseAddDatabase
|
||||
case CommandDatabaseEnable:
|
||||
|
|
|
@ -387,6 +387,12 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
|
|||
case cdp.CommandNetworkGetCertificate:
|
||||
v = new(network.GetCertificateReturns)
|
||||
|
||||
case cdp.CommandNetworkEnableRequestInterception:
|
||||
return emptyVal, nil
|
||||
|
||||
case cdp.CommandNetworkContinueInterceptedRequest:
|
||||
return emptyVal, nil
|
||||
|
||||
case cdp.EventNetworkResourceChangedPriority:
|
||||
v = new(network.EventResourceChangedPriority)
|
||||
|
||||
|
@ -432,6 +438,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
|
|||
case cdp.EventNetworkEventSourceMessageReceived:
|
||||
v = new(network.EventEventSourceMessageReceived)
|
||||
|
||||
case cdp.EventNetworkRequestIntercepted:
|
||||
v = new(network.EventRequestIntercepted)
|
||||
|
||||
case cdp.CommandDatabaseEnable:
|
||||
return emptyVal, nil
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -130,6 +130,16 @@ type EventEventSourceMessageReceived struct {
|
|||
Data string `json:"data,omitempty"` // Message content.
|
||||
}
|
||||
|
||||
// EventRequestIntercepted details of an intercepted HTTP request, which must
|
||||
// be either allowed, blocked, modified or mocked.
|
||||
type EventRequestIntercepted struct {
|
||||
InterceptionID InterceptionID `json:"InterceptionId,omitempty"` // Each request the page makes will have a unique id, however if any redirects are encountered while processing that fetch, they will be reported with the same id as the original fetch.
|
||||
Request *Request `json:"request,omitempty"`
|
||||
RedirectHeaders *Headers `json:"redirectHeaders,omitempty"` // HTTP response headers, only sent if a redirect was intercepted.
|
||||
RedirectStatusCode int64 `json:"redirectStatusCode,omitempty"` // HTTP response code, only sent if a redirect was intercepted.
|
||||
RedirectURL string `json:"redirectUrl,omitempty"` // Redirect location, only sent if a redirect was intercepted.
|
||||
}
|
||||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventNetworkResourceChangedPriority,
|
||||
|
@ -147,4 +157,5 @@ var EventTypes = []cdp.MethodType{
|
|||
cdp.EventNetworkWebSocketFrameError,
|
||||
cdp.EventNetworkWebSocketFrameSent,
|
||||
cdp.EventNetworkEventSourceMessageReceived,
|
||||
cdp.EventNetworkRequestIntercepted,
|
||||
}
|
||||
|
|
|
@ -655,3 +655,98 @@ func (p *GetCertificateParams) Do(ctxt context.Context, h cdp.Handler) (tableNam
|
|||
|
||||
return res.TableNames, nil
|
||||
}
|
||||
|
||||
// EnableRequestInterceptionParams [no description].
|
||||
type EnableRequestInterceptionParams struct {
|
||||
Enabled bool `json:"enabled"` // Whether or not HTTP requests should be intercepted and Network.requestIntercepted events sent.
|
||||
}
|
||||
|
||||
// EnableRequestInterception [no description].
|
||||
//
|
||||
// parameters:
|
||||
// enabled - Whether or not HTTP requests should be intercepted and Network.requestIntercepted events sent.
|
||||
func EnableRequestInterception(enabled bool) *EnableRequestInterceptionParams {
|
||||
return &EnableRequestInterceptionParams{
|
||||
Enabled: enabled,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Network.enableRequestInterception against the provided context and
|
||||
// target handler.
|
||||
func (p *EnableRequestInterceptionParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandNetworkEnableRequestInterception, p, nil)
|
||||
}
|
||||
|
||||
// ContinueInterceptedRequestParams response to Network.requestIntercepted
|
||||
// which either modifies the request to continue with any modifications, or
|
||||
// blocks it, or completes it with the provided response bytes. If a network
|
||||
// fetch occurs as a result which encounters a redirect an additional
|
||||
// Network.requestIntercepted event will be sent with the same InterceptionId.
|
||||
type ContinueInterceptedRequestParams struct {
|
||||
InterceptionID InterceptionID `json:"interceptionId"`
|
||||
ErrorReason ErrorReason `json:"errorReason,omitempty"` // If set this causes the request to fail with the given reason.
|
||||
RawResponse string `json:"rawResponse,omitempty"` // If set the requests completes using with the provided base64 encoded raw response, including HTTP status line and headers etc...
|
||||
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 this allows the request method to be overridden.
|
||||
PostData string `json:"postData,omitempty"` // If set this allows postData to be set.
|
||||
Headers *Headers `json:"headers,omitempty"` // If set this allows the request headers to be changed.
|
||||
}
|
||||
|
||||
// ContinueInterceptedRequest response to Network.requestIntercepted which
|
||||
// either modifies the request to continue with any modifications, or blocks it,
|
||||
// or completes it with the provided response bytes. If a network fetch occurs
|
||||
// as a result which encounters a redirect an additional
|
||||
// Network.requestIntercepted event will be sent with the same InterceptionId.
|
||||
//
|
||||
// parameters:
|
||||
// interceptionID
|
||||
func ContinueInterceptedRequest(interceptionID InterceptionID) *ContinueInterceptedRequestParams {
|
||||
return &ContinueInterceptedRequestParams{
|
||||
InterceptionID: interceptionID,
|
||||
}
|
||||
}
|
||||
|
||||
// WithErrorReason if set this causes the request to fail with the given
|
||||
// reason.
|
||||
func (p ContinueInterceptedRequestParams) WithErrorReason(errorReason ErrorReason) *ContinueInterceptedRequestParams {
|
||||
p.ErrorReason = errorReason
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithRawResponse if set the requests completes using with the provided
|
||||
// base64 encoded raw response, including HTTP status line and headers etc...
|
||||
func (p ContinueInterceptedRequestParams) WithRawResponse(rawResponse string) *ContinueInterceptedRequestParams {
|
||||
p.RawResponse = rawResponse
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithURL if set the request url will be modified in a way that's not
|
||||
// observable by page.
|
||||
func (p ContinueInterceptedRequestParams) WithURL(url string) *ContinueInterceptedRequestParams {
|
||||
p.URL = url
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithMethod if set this allows the request method to be overridden.
|
||||
func (p ContinueInterceptedRequestParams) WithMethod(method string) *ContinueInterceptedRequestParams {
|
||||
p.Method = method
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithPostData if set this allows postData to be set.
|
||||
func (p ContinueInterceptedRequestParams) WithPostData(postData string) *ContinueInterceptedRequestParams {
|
||||
p.PostData = postData
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithHeaders if set this allows the request headers to be changed.
|
||||
func (p ContinueInterceptedRequestParams) WithHeaders(headers *Headers) *ContinueInterceptedRequestParams {
|
||||
p.Headers = headers
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes Network.continueInterceptedRequest against the provided context and
|
||||
// target handler.
|
||||
func (p *ContinueInterceptedRequestParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandNetworkContinueInterceptedRequest, p, nil)
|
||||
}
|
||||
|
|
|
@ -22,6 +22,86 @@ func (t RequestID) String() string {
|
|||
return string(t)
|
||||
}
|
||||
|
||||
// InterceptionID unique intercepted request identifier.
|
||||
type InterceptionID string
|
||||
|
||||
// String returns the InterceptionID as string value.
|
||||
func (t InterceptionID) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// ErrorReason network level fetch failure reason.
|
||||
type ErrorReason string
|
||||
|
||||
// String returns the ErrorReason as string value.
|
||||
func (t ErrorReason) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// ErrorReason values.
|
||||
const (
|
||||
ErrorReasonFailed ErrorReason = "Failed"
|
||||
ErrorReasonAborted ErrorReason = "Aborted"
|
||||
ErrorReasonTimedOut ErrorReason = "TimedOut"
|
||||
ErrorReasonAccessDenied ErrorReason = "AccessDenied"
|
||||
ErrorReasonConnectionClosed ErrorReason = "ConnectionClosed"
|
||||
ErrorReasonConnectionReset ErrorReason = "ConnectionReset"
|
||||
ErrorReasonConnectionRefused ErrorReason = "ConnectionRefused"
|
||||
ErrorReasonConnectionAborted ErrorReason = "ConnectionAborted"
|
||||
ErrorReasonConnectionFailed ErrorReason = "ConnectionFailed"
|
||||
ErrorReasonNameNotResolved ErrorReason = "NameNotResolved"
|
||||
ErrorReasonInternetDisconnected ErrorReason = "InternetDisconnected"
|
||||
ErrorReasonAddressUnreachable ErrorReason = "AddressUnreachable"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t ErrorReason) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t ErrorReason) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *ErrorReason) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch ErrorReason(in.String()) {
|
||||
case ErrorReasonFailed:
|
||||
*t = ErrorReasonFailed
|
||||
case ErrorReasonAborted:
|
||||
*t = ErrorReasonAborted
|
||||
case ErrorReasonTimedOut:
|
||||
*t = ErrorReasonTimedOut
|
||||
case ErrorReasonAccessDenied:
|
||||
*t = ErrorReasonAccessDenied
|
||||
case ErrorReasonConnectionClosed:
|
||||
*t = ErrorReasonConnectionClosed
|
||||
case ErrorReasonConnectionReset:
|
||||
*t = ErrorReasonConnectionReset
|
||||
case ErrorReasonConnectionRefused:
|
||||
*t = ErrorReasonConnectionRefused
|
||||
case ErrorReasonConnectionAborted:
|
||||
*t = ErrorReasonConnectionAborted
|
||||
case ErrorReasonConnectionFailed:
|
||||
*t = ErrorReasonConnectionFailed
|
||||
case ErrorReasonNameNotResolved:
|
||||
*t = ErrorReasonNameNotResolved
|
||||
case ErrorReasonInternetDisconnected:
|
||||
*t = ErrorReasonInternetDisconnected
|
||||
case ErrorReasonAddressUnreachable:
|
||||
*t = ErrorReasonAddressUnreachable
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown ErrorReason value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *ErrorReason) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
// Headers request / response headers as keys / values of JSON object.
|
||||
type Headers struct{}
|
||||
|
||||
|
|
|
@ -2343,6 +2343,30 @@
|
|||
"type": "string",
|
||||
"description": "Unique request identifier."
|
||||
},
|
||||
{
|
||||
"id": "InterceptionId",
|
||||
"type": "string",
|
||||
"description": "Unique intercepted request identifier."
|
||||
},
|
||||
{
|
||||
"id": "ErrorReason",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Failed",
|
||||
"Aborted",
|
||||
"TimedOut",
|
||||
"AccessDenied",
|
||||
"ConnectionClosed",
|
||||
"ConnectionReset",
|
||||
"ConnectionRefused",
|
||||
"ConnectionAborted",
|
||||
"ConnectionFailed",
|
||||
"NameNotResolved",
|
||||
"InternetDisconnected",
|
||||
"AddressUnreachable"
|
||||
],
|
||||
"description": "Network level fetch failure reason."
|
||||
},
|
||||
{
|
||||
"id": "Timestamp",
|
||||
"type": "number",
|
||||
|
@ -3350,6 +3374,64 @@
|
|||
}
|
||||
],
|
||||
"experimental": true
|
||||
},
|
||||
{
|
||||
"name": "enableRequestInterception",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "enabled",
|
||||
"type": "boolean",
|
||||
"description": "Whether or not HTTP requests should be intercepted and Network.requestIntercepted events sent."
|
||||
}
|
||||
],
|
||||
"experimental": true
|
||||
},
|
||||
{
|
||||
"name": "continueInterceptedRequest",
|
||||
"description": "Response to Network.requestIntercepted which either modifies the request to continue with any modifications, or blocks it, or completes it with the provided response bytes. If a network fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted event will be sent with the same InterceptionId.",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "interceptionId",
|
||||
"$ref": "InterceptionId"
|
||||
},
|
||||
{
|
||||
"name": "errorReason",
|
||||
"$ref": "ErrorReason",
|
||||
"optional": true,
|
||||
"description": "If set this causes the request to fail with the given reason."
|
||||
},
|
||||
{
|
||||
"name": "rawResponse",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"description": "If set the requests completes using with the provided base64 encoded raw response, including HTTP status line and headers etc..."
|
||||
},
|
||||
{
|
||||
"name": "url",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"description": "If set the request url will be modified in a way that's not observable by page."
|
||||
},
|
||||
{
|
||||
"name": "method",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"description": "If set this allows the request method to be overridden."
|
||||
},
|
||||
{
|
||||
"name": "postData",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"description": "If set this allows postData to be set."
|
||||
},
|
||||
{
|
||||
"name": "headers",
|
||||
"$ref": "Headers",
|
||||
"optional": true,
|
||||
"description": "If set this allows the request headers to be changed."
|
||||
}
|
||||
],
|
||||
"experimental": true
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
|
@ -3757,6 +3839,40 @@
|
|||
}
|
||||
],
|
||||
"experimental": true
|
||||
},
|
||||
{
|
||||
"name": "requestIntercepted",
|
||||
"description": "Details of an intercepted HTTP request, which must be either allowed, blocked, modified or mocked.",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "InterceptionId",
|
||||
"$ref": "InterceptionId",
|
||||
"description": "Each request the page makes will have a unique id, however if any redirects are encountered while processing that fetch, they will be reported with the same id as the original fetch."
|
||||
},
|
||||
{
|
||||
"name": "request",
|
||||
"$ref": "Request"
|
||||
},
|
||||
{
|
||||
"name": "redirectHeaders",
|
||||
"$ref": "Headers",
|
||||
"optional": true,
|
||||
"description": "HTTP response headers, only sent if a redirect was intercepted."
|
||||
},
|
||||
{
|
||||
"name": "redirectStatusCode",
|
||||
"type": "integer",
|
||||
"optional": true,
|
||||
"description": "HTTP response code, only sent if a redirect was intercepted."
|
||||
},
|
||||
{
|
||||
"name": "redirectUrl",
|
||||
"optional": true,
|
||||
"type": "string",
|
||||
"description": "Redirect location, only sent if a redirect was intercepted."
|
||||
}
|
||||
],
|
||||
"experimental": true
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -4,13 +4,6 @@
|
|||
//line templates/domain.qtpl:1
|
||||
package templates
|
||||
|
||||
//line templates/domain.qtpl:1
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/domain.qtpl:1
|
||||
import (
|
||||
"github.com/knq/chromedp/cmd/chromedp-gen/internal"
|
||||
|
@ -18,6 +11,13 @@ import (
|
|||
|
||||
// DomainTemplate is the template for a single domain.
|
||||
|
||||
//line templates/domain.qtpl:6
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/domain.qtpl:6
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
|
|
|
@ -4,13 +4,6 @@
|
|||
//line templates/extra.qtpl:1
|
||||
package templates
|
||||
|
||||
//line templates/extra.qtpl:1
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/extra.qtpl:1
|
||||
import (
|
||||
"github.com/knq/chromedp/cmd/chromedp-gen/internal"
|
||||
|
@ -19,6 +12,13 @@ import (
|
|||
// ExtraTimestampTemplate is a special template for the Timestamp type that
|
||||
// defines its JSON unmarshaling.
|
||||
|
||||
//line templates/extra.qtpl:7
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/extra.qtpl:7
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
|
|
|
@ -4,13 +4,6 @@
|
|||
//line templates/file.qtpl:1
|
||||
package templates
|
||||
|
||||
//line templates/file.qtpl:1
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/file.qtpl:1
|
||||
import (
|
||||
"sort"
|
||||
|
@ -20,6 +13,13 @@ import (
|
|||
|
||||
// FileHeader is the file header template.
|
||||
|
||||
//line templates/file.qtpl:8
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/file.qtpl:8
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
|
|
|
@ -4,13 +4,6 @@
|
|||
//line templates/type.qtpl:1
|
||||
package templates
|
||||
|
||||
//line templates/type.qtpl:1
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/type.qtpl:1
|
||||
import (
|
||||
"strconv"
|
||||
|
@ -21,6 +14,13 @@ import (
|
|||
|
||||
// TypeTemplate is a template for a Typable type.
|
||||
|
||||
//line templates/type.qtpl:9
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/type.qtpl:9
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
|
|
Loading…
Reference in New Issue
Block a user