-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: always use json for http requests/responses #92
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: guillaume <[email protected]>
Signed-off-by: guillaume <[email protected]>
Signed-off-by: guillaume <[email protected]>
Signed-off-by: guillaume <[email protected]>
Signed-off-by: guillaume <[email protected]>
Signed-off-by: guillaume <[email protected]>
Signed-off-by: guillaume <[email protected]>
gruyaume
changed the title
feat: always return json responses
feat: always use json for http requests/responses
Sep 23, 2024
kayra1
requested changes
Sep 24, 2024
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.
Thanks
Signed-off-by: guillaume <[email protected]>
Signed-off-by: guillaume <[email protected]>
kayra1
approved these changes
Sep 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Here we ensure that every API calls takes json objects as request parameters and return json objects in its responses.
Standardized responses
Each return object now has the following format
Rationale
Request parameters
HTTP Request Parameters were inconsistents. Some had to be json formatted, some didn't. For example creating a user required a the following body:
And creating a certificate required the bare certificate:
Related quality improvements
Doing so we address many of related Ben's feedback. Namely:
writeError
andwriteJSON
functionshandlers_health
->handlers_status
(endpoint:/status
)handlers_users
->handlers_accounts
(endpoint:/api/v1/accounts
)testdata
instead of having long strings in test filesnumUsers
to get the number of users instead of listing them and computing the list lengthThis is a breaking change
This is a breaking change, anything that depended on Notary's API (here luckily only the charm) will need to be adapted.
Checklist: