Skip to content

Commit

Permalink
align previous
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Jan 10, 2025
1 parent 7aa1040 commit 5bd1207
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions server/v2/api/grpcgateway/uri.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ func createMessage(match *uriMatch) (gogoproto.Message, error) {
if err != nil {
return nil, status.Error(codes.Internal, "failed to create message instance")
}

if err := decoder.Decode(nestedParams); err != nil {
err = decoder.Decode(nestedParams)
if err != nil && !strings.Contains(err.Error(), "order_by") {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
}
Expand Down
20 changes: 19 additions & 1 deletion tests/systemtests/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,30 @@ func TestGetTxEvents_GRPCGateway(t *testing.T) {
},
{
"valid request: order by asc",
fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?query=%s&query=%s&order_by=%d", baseURL, bankMsgSendEventAction, "message.module='bank'", tx.OrderBy_ORDER_BY_ASC),
fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?query=%s&query=%s&order_by=ORDER_BY_ASC", baseURL, bankMsgSendEventAction, "message.module='bank'"),
false,
"", 2,
},
{
"valid request: order by desc",
fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?query=%s&query=%s&order_by=ORDER_BY_DESC", baseURL, bankMsgSendEventAction, "message.module='bank'"),
false,
"", 2,
},
{
"invalid request: invalid order by",
fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?query=%s&query=%s&order_by=invalid_order", baseURL, bankMsgSendEventAction, "message.module='bank'"),
true,
"is not a valid tx.OrderBy", 0,
},
{
"valid request: order by 1",
fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?query=%s&query=%s&order_by=%d", baseURL, bankMsgSendEventAction, "message.module='bank'", tx.OrderBy_ORDER_BY_ASC),
false,
"", 2,
},
{
"valid request: order by 2",
fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?query=%s&query=%s&order_by=%d", baseURL, bankMsgSendEventAction, "message.module='bank'", tx.OrderBy_ORDER_BY_DESC),
false,
"", 2,
Expand Down

0 comments on commit 5bd1207

Please sign in to comment.