-
-
Notifications
You must be signed in to change notification settings - Fork 961
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
fix: error handling on identity import #3520
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3520 +/- ##
==========================================
+ Coverage 78.17% 78.31% +0.13%
==========================================
Files 341 341
Lines 22754 22679 -75
==========================================
- Hits 17789 17761 -28
+ Misses 3626 3591 -35
+ Partials 1339 1327 -12
|
if len(i.Traits) == 0 { | ||
i.Traits = []byte(`{}`) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix. Without, sjson.SetRawBytes
below would produce invalid JSON, although the payload is valid JSON.
When importing identities without any traits, or with malformed traits, 500s are returned. This improves the error handling and messaging.
Per default, missing traits now get rewritten to an empty object. Otherwise sjson would produce invalid JSON, and JSON parse errors would be returned even though the payload was valid.