Skip to content

Commit 3b4250f

Browse files
benluddyk8s-publishing-bot
authored andcommitted
Wire serving codecs to CBOR feature gate.
Integration testing has to this point relied on patching serving codecs for built-in APIs. The test-only patching is removed and replaced by feature gated checks at runtime. Kubernetes-commit: 439d2f7b4028638b3d8d9261bb046c3ba8d9bfcb
1 parent daaad09 commit 3b4250f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pkg/runtime/serializer/cbor/cbor.go

+15
Original file line numberDiff line numberDiff line change
@@ -372,3 +372,18 @@ var selfDescribedCBOR = []byte{0xd9, 0xd9, 0xf7}
372372
func (s *serializer) RecognizesData(data []byte) (ok, unknown bool, err error) {
373373
return bytes.HasPrefix(data, selfDescribedCBOR), false, nil
374374
}
375+
376+
// NewSerializerInfo returns a default SerializerInfo for CBOR using the given creater and typer.
377+
func NewSerializerInfo(creater runtime.ObjectCreater, typer runtime.ObjectTyper) runtime.SerializerInfo {
378+
return runtime.SerializerInfo{
379+
MediaType: "application/cbor",
380+
MediaTypeType: "application",
381+
MediaTypeSubType: "cbor",
382+
Serializer: NewSerializer(creater, typer),
383+
StrictSerializer: NewSerializer(creater, typer, Strict(true)),
384+
StreamSerializer: &runtime.StreamSerializerInfo{
385+
Framer: NewFramer(),
386+
Serializer: NewSerializer(creater, typer, Transcode(false)),
387+
},
388+
}
389+
}

0 commit comments

Comments
 (0)