fix(cli): Status code on api error
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 commit is contained in:
17 files changed
+101
-62
No files matched your search
@@ -23,6 +23,7 @@ type Feature int
|
||||
const (
|
||||
UnknownFeature Feature = iota
|
||||
MultiHopSessionFeature
|
||||
IncludeStatusInCli
|
||||
)
|
||||
|
||||
var featureMap map[Feature]MetadataConstraint
|
||||
@@ -52,6 +53,10 @@ func init() {
|
||||
Constraints: mustNewConstraints(">= 0.1.0"), // This feature exists at 0.1.0 and above
|
||||
}
|
||||
*/
|
||||
featureMap[IncludeStatusInCli] = MetadataConstraint{
|
||||
MetaInfo: []Metadata{OSS, HCP},
|
||||
Constraints: mustNewConstraints("< 0.14.0"),
|
||||
}
|
||||
}
|
||||
|
||||
func metadataStringToMetadata(m string) Metadata {
|
||||
|
||||
Reference in new issue
Block a user