Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to decode CBOR's undefined to null #45

Merged
merged 2 commits into from
Nov 20, 2018
Merged

option to decode CBOR's undefined to null #45

merged 2 commits into from
Nov 20, 2018

Conversation

warpfork
Copy link
Member

This is #44 (thanks @Stebalien !) plus another commit to add a flag in cbor.DecodeOptions to decide whether or not you want "undefined" to be coerced to a null token. The default is to error.

Stebalien and others added 2 commits November 14, 2018 13:22
Bleh. We're not going to round-trip this but we shouldn't hit this anyways.

Alternatively, we could just return an error. However, that may break things for
some users...

fixes #43
By default we will raise an error if we encounter the cbor "undefined"
byte, because it's a long way from a canonical object if it has one of
these bytes in it, and I think we should not be silent about that.
If you want to coerce it to null: that's also an option!

Diff is a bit larger than one might expect it should be because this
turns out to be the first decoding option we've actually passed
through all the way to the decoder.

Signed-off-by: Eric Myhre <hash@exultant.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants