Fixing issue with Network.Headers type
This commit is contained in:
parent
59b4e8a6af
commit
8593dbf08e
File diff suppressed because it is too large
Load Diff
|
@ -136,7 +136,7 @@ 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. Likewise if HTTP authentication is needed then the same fetch id will be used.
|
||||
Request *Request `json:"request,omitempty"`
|
||||
ResourceType page.ResourceType `json:"resourceType,omitempty"` // How the requested resource will be used.
|
||||
RedirectHeaders *Headers `json:"redirectHeaders,omitempty"` // HTTP response headers, only sent if a redirect was intercepted.
|
||||
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.
|
||||
AuthChallenge *AuthChallenge `json:"authChallenge,omitempty"` // Details of the Authorization Challenge encountered. If this is set then continueInterceptedRequest must contain an authChallengeResponse.
|
||||
|
|
|
@ -93,7 +93,7 @@ func (p *SetUserAgentOverrideParams) Do(ctxt context.Context, h cdp.Handler) (er
|
|||
// SetExtraHTTPHeadersParams specifies whether to always send extra HTTP
|
||||
// headers with the requests from this page.
|
||||
type SetExtraHTTPHeadersParams struct {
|
||||
Headers *Headers `json:"headers"` // Map with extra HTTP headers.
|
||||
Headers Headers `json:"headers"` // Map with extra HTTP headers.
|
||||
}
|
||||
|
||||
// SetExtraHTTPHeaders specifies whether to always send extra HTTP headers
|
||||
|
@ -101,7 +101,7 @@ type SetExtraHTTPHeadersParams struct {
|
|||
//
|
||||
// parameters:
|
||||
// headers - Map with extra HTTP headers.
|
||||
func SetExtraHTTPHeaders(headers *Headers) *SetExtraHTTPHeadersParams {
|
||||
func SetExtraHTTPHeaders(headers Headers) *SetExtraHTTPHeadersParams {
|
||||
return &SetExtraHTTPHeadersParams{
|
||||
Headers: headers,
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ type ContinueInterceptedRequestParams struct {
|
|||
URL string `json:"url,omitempty"` // If set the request url will be modified in a way that's not observable by page. Must not be set in response to an authChallenge.
|
||||
Method string `json:"method,omitempty"` // If set this allows the request method to be overridden. Must not be set in response to an authChallenge.
|
||||
PostData string `json:"postData,omitempty"` // If set this allows postData to be set. Must not be set in response to an authChallenge.
|
||||
Headers *Headers `json:"headers,omitempty"` // If set this allows the request headers to be changed. Must not be set in response to an authChallenge.
|
||||
Headers Headers `json:"headers,omitempty"` // If set this allows the request headers to be changed. Must not be set in response to an authChallenge.
|
||||
AuthChallengeResponse *AuthChallengeResponse `json:"authChallengeResponse,omitempty"` // Response to a requestIntercepted with an authChallenge. Must not be set otherwise.
|
||||
}
|
||||
|
||||
|
@ -745,7 +745,7 @@ func (p ContinueInterceptedRequestParams) WithPostData(postData string) *Continu
|
|||
|
||||
// WithHeaders if set this allows the request headers to be changed. Must not
|
||||
// be set in response to an authChallenge.
|
||||
func (p ContinueInterceptedRequestParams) WithHeaders(headers *Headers) *ContinueInterceptedRequestParams {
|
||||
func (p ContinueInterceptedRequestParams) WithHeaders(headers Headers) *ContinueInterceptedRequestParams {
|
||||
p.Headers = headers
|
||||
return &p
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ func (t *ErrorReason) UnmarshalJSON(buf []byte) error {
|
|||
}
|
||||
|
||||
// Headers request / response headers as keys / values of JSON object.
|
||||
type Headers struct{}
|
||||
type Headers map[string]interface{}
|
||||
|
||||
// ConnectionType loading priority of a resource request.
|
||||
type ConnectionType string
|
||||
|
@ -286,7 +286,7 @@ func (t *ResourcePriority) UnmarshalJSON(buf []byte) error {
|
|||
type Request struct {
|
||||
URL string `json:"url,omitempty"` // Request URL.
|
||||
Method string `json:"method,omitempty"` // HTTP request method.
|
||||
Headers *Headers `json:"headers,omitempty"` // HTTP request headers.
|
||||
Headers Headers `json:"headers,omitempty"` // HTTP request headers.
|
||||
PostData string `json:"postData,omitempty"` // HTTP POST request data.
|
||||
MixedContentType MixedContentType `json:"mixedContentType,omitempty"` // The mixed content status of the request, as defined in http://www.w3.org/TR/mixed-content/
|
||||
InitialPriority ResourcePriority `json:"initialPriority,omitempty"` // Priority of the resource request at the time request is sent.
|
||||
|
@ -382,10 +382,10 @@ type Response struct {
|
|||
URL string `json:"url,omitempty"` // Response URL. This URL can be different from CachedResource.url in case of redirect.
|
||||
Status float64 `json:"status,omitempty"` // HTTP response status code.
|
||||
StatusText string `json:"statusText,omitempty"` // HTTP response status text.
|
||||
Headers *Headers `json:"headers,omitempty"` // HTTP response headers.
|
||||
Headers Headers `json:"headers,omitempty"` // HTTP response headers.
|
||||
HeadersText string `json:"headersText,omitempty"` // HTTP response headers text.
|
||||
MimeType string `json:"mimeType,omitempty"` // Resource mimeType as determined by the browser.
|
||||
RequestHeaders *Headers `json:"requestHeaders,omitempty"` // Refined HTTP request headers that were actually transmitted over the network.
|
||||
RequestHeaders Headers `json:"requestHeaders,omitempty"` // Refined HTTP request headers that were actually transmitted over the network.
|
||||
RequestHeadersText string `json:"requestHeadersText,omitempty"` // HTTP request headers text.
|
||||
ConnectionReused bool `json:"connectionReused,omitempty"` // Specifies whether physical connection was actually reused for this request.
|
||||
ConnectionID float64 `json:"connectionId,omitempty"` // Physical connection id that was actually used for this request.
|
||||
|
@ -402,17 +402,17 @@ type Response struct {
|
|||
|
||||
// WebSocketRequest webSocket request data.
|
||||
type WebSocketRequest struct {
|
||||
Headers *Headers `json:"headers,omitempty"` // HTTP request headers.
|
||||
Headers Headers `json:"headers,omitempty"` // HTTP request headers.
|
||||
}
|
||||
|
||||
// WebSocketResponse webSocket response data.
|
||||
type WebSocketResponse struct {
|
||||
Status float64 `json:"status,omitempty"` // HTTP response status code.
|
||||
StatusText string `json:"statusText,omitempty"` // HTTP response status text.
|
||||
Headers *Headers `json:"headers,omitempty"` // HTTP response headers.
|
||||
HeadersText string `json:"headersText,omitempty"` // HTTP response headers text.
|
||||
RequestHeaders *Headers `json:"requestHeaders,omitempty"` // HTTP request headers.
|
||||
RequestHeadersText string `json:"requestHeadersText,omitempty"` // HTTP request headers text.
|
||||
Status float64 `json:"status,omitempty"` // HTTP response status code.
|
||||
StatusText string `json:"statusText,omitempty"` // HTTP response status text.
|
||||
Headers Headers `json:"headers,omitempty"` // HTTP response headers.
|
||||
HeadersText string `json:"headersText,omitempty"` // HTTP response headers text.
|
||||
RequestHeaders Headers `json:"requestHeaders,omitempty"` // HTTP request headers.
|
||||
RequestHeadersText string `json:"requestHeadersText,omitempty"` // HTTP request headers text.
|
||||
}
|
||||
|
||||
// WebSocketFrame webSocket frame data.
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
// - rename 'Input.GestureSourceType' -> 'Input.GestureType'.
|
||||
// - rename CSS.CSS* types.
|
||||
// - add Error() method to 'Runtime.ExceptionDetails' type so that it can be used as error.
|
||||
// - change 'Network.Headers' type to map[string]interface{}.
|
||||
//
|
||||
// Please note that the above is not an exhaustive list of all modifications
|
||||
// applied to the domains, however it does attempt to give a comprehensive
|
||||
|
@ -333,6 +334,12 @@ func FixDomains(domains []*internal.Domain) {
|
|||
t.Type = internal.TypeTimestamp
|
||||
t.Extra += templates.ExtraTimestampTemplate(t, d)
|
||||
}
|
||||
|
||||
// change Headers to be a map[string]interface{}
|
||||
if t.ID == "Headers" {
|
||||
t.Type = internal.TypeAny
|
||||
t.Ref = "map[string]interface{}"
|
||||
}
|
||||
}
|
||||
|
||||
case internal.DomainRuntime:
|
||||
|
|
|
@ -266,17 +266,19 @@ func (t *Type) EnumValueName(v string) string {
|
|||
|
||||
// GoTypeDef returns the Go type definition for the type.
|
||||
func (t *Type) GoTypeDef(d *Domain, domains []*Domain, extra []*Type, noExposeOverride, omitOnlyWhenOptional bool) string {
|
||||
if t.Parameters != nil {
|
||||
switch {
|
||||
case t.Parameters != nil:
|
||||
return structDef(append(extra, t.Parameters...), d, domains, noExposeOverride, omitOnlyWhenOptional)
|
||||
}
|
||||
|
||||
switch t.Type {
|
||||
case TypeArray:
|
||||
case t.Type == TypeArray:
|
||||
_, o, _ := t.Items.ResolveType(d, domains)
|
||||
return "[]" + o.GoTypeDef(d, domains, nil, false, false)
|
||||
|
||||
case TypeObject:
|
||||
case t.Type == TypeObject:
|
||||
return structDef(append(extra, t.Properties...), d, domains, noExposeOverride, omitOnlyWhenOptional)
|
||||
|
||||
case t.Type == TypeAny && t.Ref != "":
|
||||
return t.Ref
|
||||
}
|
||||
|
||||
return t.Type.GoType()
|
||||
|
|
Loading…
Reference in New Issue
Block a user