Skip to content

Commit 5e0ef5f

Browse files
authored
Merge pull request #1664 from alvaroaleman/unconditionally-set-negotioated-serializer
🐛 Unconditionally set NegotiatedSerializer
2 parents 386c2b5 + 8100b57 commit 5e0ef5f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

pkg/client/apiutil/apimachinery.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,12 @@ func createRestConfig(gvk schema.GroupVersionKind, isUnstructured bool, baseConf
158158
protobufSchemeLock.RUnlock()
159159
}
160160

161-
if cfg.NegotiatedSerializer == nil {
162-
if isUnstructured {
163-
// If the object is unstructured, we need to preserve the GVK information.
164-
// Use our own custom serializer.
165-
cfg.NegotiatedSerializer = serializerWithDecodedGVK{serializer.WithoutConversionCodecFactory{CodecFactory: codecs}}
166-
} else {
167-
cfg.NegotiatedSerializer = serializerWithTargetZeroingDecode{NegotiatedSerializer: serializer.WithoutConversionCodecFactory{CodecFactory: codecs}}
168-
}
161+
if isUnstructured {
162+
// If the object is unstructured, we need to preserve the GVK information.
163+
// Use our own custom serializer.
164+
cfg.NegotiatedSerializer = serializerWithDecodedGVK{serializer.WithoutConversionCodecFactory{CodecFactory: codecs}}
165+
} else {
166+
cfg.NegotiatedSerializer = serializerWithTargetZeroingDecode{NegotiatedSerializer: serializer.WithoutConversionCodecFactory{CodecFactory: codecs}}
169167
}
170168

171169
return cfg

0 commit comments

Comments
 (0)