-
Notifications
You must be signed in to change notification settings - Fork 292
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(cli): Status code on api error #2887
Conversation
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.
Shouldn't we just bite the bullet and remove status_code
? Or at least deprecate it so we can remove it in a later release and move usage to status
?
EDIT: I mean the other way around, deprecating the old one.
15c5fb5
to
8c6e0f1
Compare
8c6e0f1
to
accda14
Compare
6546fcf
to
5bdfa05
Compare
got=$(echo "$output") | ||
|
||
run field_eq "$got" ".item.attributes.key_type" '"ecdsa"' | ||
[ "$status" -eq 0 ] |
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.
Do you want an echo "$output"
here to get debug info from field_eq
?
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.
I am not sure how useful it is. The message from jq
isn't the greatest. The output from the read_credential_library
should already show the full json that is being used for the comparison.
accda14
to
a88bcc2
Compare
a8581fc
to
f95c0ef
Compare
a88bcc2
to
8624819
Compare
f95c0ef
to
5540d39
Compare
This ensures that checks for features should work, and bails early if that is not the case, since if this fails the binary is essentially broken. This also simplifies code that performs these checks, ie instead of: binaryVersion, err := version.GetReleaseVersion() if err != nil { // handle error? panic? } if version.SupportsFeature(binaryVersion, version.FeatureA) { // code for FeatureA } else { // without FeatureA } Implementations can do: if version.SupportsFeature(version.Binary, version.FeatureA) { // code for FeatureA } else { // without FeatureA }
When using the json output of the cli (`-format=json`), a successful call to the controller API would place the HTTP status code in the JSON as `status_code`. However, if there was an error from the API the status code would be placed in the JSON as `status`. In order to be consistent, this adds a `status_code` field to the error response case. For backwards compatibility it still populates `status` in the error case. This inconsistency was missed partially due to a bug in the CLI tests. The assertion on status code was not valid and would always be successful. Thus this also fixes the assertions and tests.
This adds tests for updating specific fields of the credential library.
d9d9957
to
f9a2f44
Compare
When using the json output of the cli (
-format=json
), a successful callto the controller API would place the HTTP status code in the JSON as
status_code
. However, if there was an error from the API the status codewould be placed in the JSON as
status
. In order to be consistent, thisadds a
status_code
field to the error response case. For backwardscompatibility it still populates
status
in the error case.This inconsistency was missed partially due to a bug in the CLI tests. The
assertion on status code was not valid and would always be successful. Thus
this also fixes the assertions and tests.