mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-27 15:39:39 +00:00
Merge pull request #76175 from stealthybox/refactor-mediatype-loops
Refactor loops over `SupportedMediaTypes()` where mediaType is used to match a single SerializerInfo{} Kubernetes-commit: 84b561033eea9a4dac5b04df4f387efa7a7e9940
This commit is contained in:
commit
89e9ab5330
@ -59,15 +59,9 @@ func (dynamicCodec) Encode(obj runtime.Object, w io.Writer) error {
|
||||
// ContentConfig returns a rest.ContentConfig for dynamic types.
|
||||
// Deprecated only used by test code and its wrong
|
||||
func ContentConfig() rest.ContentConfig {
|
||||
var jsonInfo runtime.SerializerInfo
|
||||
// TODO: scheme.Codecs here should become "pkg/apis/server/scheme" which is the minimal core you need
|
||||
// to talk to a kubernetes server
|
||||
for _, info := range scheme.Codecs.SupportedMediaTypes() {
|
||||
if info.MediaType == runtime.ContentTypeJSON {
|
||||
jsonInfo = info
|
||||
break
|
||||
}
|
||||
}
|
||||
jsonInfo, _ := runtime.SerializerInfoForMediaType(scheme.Codecs.SupportedMediaTypes(), runtime.ContentTypeJSON)
|
||||
|
||||
jsonInfo.Serializer = dynamicCodec{}
|
||||
jsonInfo.PrettySerializer = nil
|
||||
|
Loading…
Reference in New Issue
Block a user