mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-30 08:51:53 +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.
|
// ContentConfig returns a rest.ContentConfig for dynamic types.
|
||||||
// Deprecated only used by test code and its wrong
|
// Deprecated only used by test code and its wrong
|
||||||
func ContentConfig() rest.ContentConfig {
|
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
|
// TODO: scheme.Codecs here should become "pkg/apis/server/scheme" which is the minimal core you need
|
||||||
// to talk to a kubernetes server
|
// to talk to a kubernetes server
|
||||||
for _, info := range scheme.Codecs.SupportedMediaTypes() {
|
jsonInfo, _ := runtime.SerializerInfoForMediaType(scheme.Codecs.SupportedMediaTypes(), runtime.ContentTypeJSON)
|
||||||
if info.MediaType == runtime.ContentTypeJSON {
|
|
||||||
jsonInfo = info
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jsonInfo.Serializer = dynamicCodec{}
|
jsonInfo.Serializer = dynamicCodec{}
|
||||||
jsonInfo.PrettySerializer = nil
|
jsonInfo.PrettySerializer = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user