mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-07 22:25:03 +00:00
vendor: Update vendor logic
This commit is contained in:
parent
c6ac5cbc87
commit
4ca64b85f0
1540 changed files with 265304 additions and 91616 deletions
21
vendor/k8s.io/apiserver/pkg/endpoints/handlers/negotiation/negotiate.go
generated
vendored
21
vendor/k8s.io/apiserver/pkg/endpoints/handlers/negotiation/negotiate.go
generated
vendored
|
|
@ -234,13 +234,6 @@ func acceptMediaTypeOptions(params map[string]string, accepts *runtime.Serialize
|
|||
return options, true
|
||||
}
|
||||
|
||||
type candidateMediaType struct {
|
||||
accepted *runtime.SerializerInfo
|
||||
clauses goautoneg.Accept
|
||||
}
|
||||
|
||||
type candidateMediaTypeSlice []candidateMediaType
|
||||
|
||||
// NegotiateMediaTypeOptions returns the most appropriate content type given the accept header and
|
||||
// a list of alternatives along with the accepted media type parameters.
|
||||
func NegotiateMediaTypeOptions(header string, accepted []runtime.SerializerInfo, endpoint EndpointRestrictions) (MediaTypeOptions, bool) {
|
||||
|
|
@ -250,25 +243,21 @@ func NegotiateMediaTypeOptions(header string, accepted []runtime.SerializerInfo,
|
|||
}, true
|
||||
}
|
||||
|
||||
var candidates candidateMediaTypeSlice
|
||||
clauses := goautoneg.ParseAccept(header)
|
||||
for _, clause := range clauses {
|
||||
for i := range clauses {
|
||||
clause := &clauses[i]
|
||||
for i := range accepted {
|
||||
accepts := &accepted[i]
|
||||
switch {
|
||||
case clause.Type == accepts.MediaTypeType && clause.SubType == accepts.MediaTypeSubType,
|
||||
clause.Type == accepts.MediaTypeType && clause.SubType == "*",
|
||||
clause.Type == "*" && clause.SubType == "*":
|
||||
candidates = append(candidates, candidateMediaType{accepted: accepts, clauses: clause})
|
||||
if retVal, ret := acceptMediaTypeOptions(clause.Params, accepts, endpoint); ret {
|
||||
return retVal, true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, v := range candidates {
|
||||
if retVal, ret := acceptMediaTypeOptions(v.clauses.Params, v.accepted, endpoint); ret {
|
||||
return retVal, true
|
||||
}
|
||||
}
|
||||
|
||||
return MediaTypeOptions{}, false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue