Skip to content

Commit

Permalink
support pair or symbol in query GET param
Browse files Browse the repository at this point in the history
  • Loading branch information
uv-orbs committed Jun 30, 2024
1 parent b0d0890 commit 58fed2e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions transport/rest/get_open_orders.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ func (h *Handler) GetOpenOrders(w http.ResponseWriter, r *http.Request) {
// symbol
symbolStr := r.URL.Query().Get("symbol")
if symbolStr == "" {
logctx.Error(ctx, "symbol is missing")
restutils.WriteJSONError(ctx, w, http.StatusBadRequest, "symbol parameter is missing")
symbolStr = r.URL.Query().Get("pair")
if symbolStr == "" {
logctx.Error(ctx, "symbol/pair is missing")
restutils.WriteJSONError(ctx, w, http.StatusBadRequest, "symbol parameter is missing")
}
return
}

symbol, err := models.StrToSymbol(symbolStr)
if err != nil {
logctx.Error(ctx, "symbol is not supported", logger.String("symbol", symbolStr))
logctx.Error(ctx, "symbol/pair is not supported", logger.String("symbol", symbolStr))
restutils.WriteJSONError(ctx, w, http.StatusBadRequest, "symbol is not supported")
return
}
Expand Down

0 comments on commit 58fed2e

Please sign in to comment.