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.
|
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"`
|
Request *Request `json:"request,omitempty"`
|
||||||
ResourceType page.ResourceType `json:"resourceType,omitempty"` // How the requested resource will be used.
|
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.
|
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.
|
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.
|
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
|
// SetExtraHTTPHeadersParams specifies whether to always send extra HTTP
|
||||||
// headers with the requests from this page.
|
// headers with the requests from this page.
|
||||||
type SetExtraHTTPHeadersParams struct {
|
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
|
// SetExtraHTTPHeaders specifies whether to always send extra HTTP headers
|
||||||
|
@ -101,7 +101,7 @@ type SetExtraHTTPHeadersParams struct {
|
||||||
//
|
//
|
||||||
// parameters:
|
// parameters:
|
||||||
// headers - Map with extra HTTP headers.
|
// headers - Map with extra HTTP headers.
|
||||||
func SetExtraHTTPHeaders(headers *Headers) *SetExtraHTTPHeadersParams {
|
func SetExtraHTTPHeaders(headers Headers) *SetExtraHTTPHeadersParams {
|
||||||
return &SetExtraHTTPHeadersParams{
|
return &SetExtraHTTPHeadersParams{
|
||||||
Headers: headers,
|
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.
|
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.
|
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.
|
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.
|
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
|
// WithHeaders if set this allows the request headers to be changed. Must not
|
||||||
// be set in response to an authChallenge.
|
// be set in response to an authChallenge.
|
||||||
func (p ContinueInterceptedRequestParams) WithHeaders(headers *Headers) *ContinueInterceptedRequestParams {
|
func (p ContinueInterceptedRequestParams) WithHeaders(headers Headers) *ContinueInterceptedRequestParams {
|
||||||
p.Headers = headers
|
p.Headers = headers
|
||||||
return &p
|
return &p
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ func (t *ErrorReason) UnmarshalJSON(buf []byte) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Headers request / response headers as keys / values of JSON object.
|
// 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.
|
// ConnectionType loading priority of a resource request.
|
||||||
type ConnectionType string
|
type ConnectionType string
|
||||||
|
@ -286,7 +286,7 @@ func (t *ResourcePriority) UnmarshalJSON(buf []byte) error {
|
||||||
type Request struct {
|
type Request struct {
|
||||||
URL string `json:"url,omitempty"` // Request URL.
|
URL string `json:"url,omitempty"` // Request URL.
|
||||||
Method string `json:"method,omitempty"` // HTTP request method.
|
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.
|
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/
|
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.
|
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.
|
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.
|
Status float64 `json:"status,omitempty"` // HTTP response status code.
|
||||||
StatusText string `json:"statusText,omitempty"` // HTTP response status text.
|
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.
|
HeadersText string `json:"headersText,omitempty"` // HTTP response headers text.
|
||||||
MimeType string `json:"mimeType,omitempty"` // Resource mimeType as determined by the browser.
|
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.
|
RequestHeadersText string `json:"requestHeadersText,omitempty"` // HTTP request headers text.
|
||||||
ConnectionReused bool `json:"connectionReused,omitempty"` // Specifies whether physical connection was actually reused for this request.
|
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.
|
ConnectionID float64 `json:"connectionId,omitempty"` // Physical connection id that was actually used for this request.
|
||||||
|
@ -402,16 +402,16 @@ type Response struct {
|
||||||
|
|
||||||
// WebSocketRequest webSocket request data.
|
// WebSocketRequest webSocket request data.
|
||||||
type WebSocketRequest struct {
|
type WebSocketRequest struct {
|
||||||
Headers *Headers `json:"headers,omitempty"` // HTTP request headers.
|
Headers Headers `json:"headers,omitempty"` // HTTP request headers.
|
||||||
}
|
}
|
||||||
|
|
||||||
// WebSocketResponse webSocket response data.
|
// WebSocketResponse webSocket response data.
|
||||||
type WebSocketResponse struct {
|
type WebSocketResponse struct {
|
||||||
Status float64 `json:"status,omitempty"` // HTTP response status code.
|
Status float64 `json:"status,omitempty"` // HTTP response status code.
|
||||||
StatusText string `json:"statusText,omitempty"` // HTTP response status text.
|
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.
|
HeadersText string `json:"headersText,omitempty"` // HTTP response headers text.
|
||||||
RequestHeaders *Headers `json:"requestHeaders,omitempty"` // HTTP request headers.
|
RequestHeaders Headers `json:"requestHeaders,omitempty"` // HTTP request headers.
|
||||||
RequestHeadersText string `json:"requestHeadersText,omitempty"` // HTTP request headers text.
|
RequestHeadersText string `json:"requestHeadersText,omitempty"` // HTTP request headers text.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
// - rename 'Input.GestureSourceType' -> 'Input.GestureType'.
|
// - rename 'Input.GestureSourceType' -> 'Input.GestureType'.
|
||||||
// - rename CSS.CSS* types.
|
// - rename CSS.CSS* types.
|
||||||
// - add Error() method to 'Runtime.ExceptionDetails' type so that it can be used as error.
|
// - 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
|
// 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
|
// 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.Type = internal.TypeTimestamp
|
||||||
t.Extra += templates.ExtraTimestampTemplate(t, d)
|
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:
|
case internal.DomainRuntime:
|
||||||
|
|
|
@ -266,17 +266,19 @@ func (t *Type) EnumValueName(v string) string {
|
||||||
|
|
||||||
// GoTypeDef returns the Go type definition for the type.
|
// GoTypeDef returns the Go type definition for the type.
|
||||||
func (t *Type) GoTypeDef(d *Domain, domains []*Domain, extra []*Type, noExposeOverride, omitOnlyWhenOptional bool) string {
|
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)
|
return structDef(append(extra, t.Parameters...), d, domains, noExposeOverride, omitOnlyWhenOptional)
|
||||||
}
|
|
||||||
|
|
||||||
switch t.Type {
|
case t.Type == TypeArray:
|
||||||
case TypeArray:
|
|
||||||
_, o, _ := t.Items.ResolveType(d, domains)
|
_, o, _ := t.Items.ResolveType(d, domains)
|
||||||
return "[]" + o.GoTypeDef(d, domains, nil, false, false)
|
return "[]" + o.GoTypeDef(d, domains, nil, false, false)
|
||||||
|
|
||||||
case TypeObject:
|
case t.Type == TypeObject:
|
||||||
return structDef(append(extra, t.Properties...), d, domains, noExposeOverride, omitOnlyWhenOptional)
|
return structDef(append(extra, t.Properties...), d, domains, noExposeOverride, omitOnlyWhenOptional)
|
||||||
|
|
||||||
|
case t.Type == TypeAny && t.Ref != "":
|
||||||
|
return t.Ref
|
||||||
}
|
}
|
||||||
|
|
||||||
return t.Type.GoType()
|
return t.Type.GoType()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user