-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Replace all REST query empty result HTTP Status codes to 200 #4065
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4065 +/- ##
===========================================
+ Coverage 60.01% 60.02% +0.01%
===========================================
Files 212 212
Lines 15107 15104 -3
===========================================
Hits 9066 9066
+ Misses 5420 5417 -3
Partials 621 621 |
1 similar comment
Codecov Report
@@ Coverage Diff @@
## develop #4065 +/- ##
===========================================
+ Coverage 60.01% 60.02% +0.01%
===========================================
Files 212 212
Lines 15107 15104 -3
===========================================
Hits 9066 9066
+ Misses 5420 5417 -3
Partials 621 621 |
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 @MarinX again for your contribution ! I left some notes that need to be addressed
x/auth/client/rest/query.go
Outdated
@@ -88,7 +88,7 @@ func QueryBalancesRequestHandlerFn( | |||
|
|||
// the query will return empty if there is no data for this account | |||
if len(res) == 0 { | |||
w.WriteHeader(http.StatusNoContent) | |||
w.WriteHeader(http.StatusOK) |
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.
curious if this function is a duplicate from the one above ?
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.
Most of it is duplicated, only change is response. Eg. for /auth/accounts/{address}
we are returning Account{}
which in case /bank/balances/{address}
we are returning sdk.Coins
The balance endpoint does not make sense for me, it should be /auth/accounts/{address}/balances
and the same function should check the endpoint and return corresponding model. But this is a API breaking change so maybe it should be a separated issue for code cleanup :)
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 agree it doesn’t make much sense. Let’s open an issue for it
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 @MarinX -- changes l look mostly good, but a bunch of return codes have been modified that shouldn't have.
Summary of change:
|
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.
Missing pending change log entry 👍
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.
ACK, missing changelog entry tho
noted. |
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.
Changelog entry is wrong
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.
Minor nit but otherwise LGMT.
Thanks for the suggestion. |
@alessio please approve :) |
All query params that are empty now returns success (http.StatusOK) instead of mixed http status codes (http.StatusNoContent/http.StatusBadRequest/ http.StatusInternalServerError) Closes: #2007
All query params that are empty will now return success (http.StatusOK) instead of mixed http status codes (http.StatusNoContent/http.StatusBadRequest/http.StatusInternalServerError)
closes: #2007
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added a relevant changelog entry:
sdkch add [section] [stanza] [message]
rereviewed
Files changed
in the github PR explorerFor Admin Use: