From e30060fc60571f03bc9b25f7b90d64e7c2bd3ee5 Mon Sep 17 00:00:00 2001 From: "shota.silagadze" Date: Wed, 15 Jan 2025 22:16:27 +0400 Subject: [PATCH] fix check --- internal/api/handler/default.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/api/handler/default.go b/internal/api/handler/default.go index 1e4836d04..b08fe7e1e 100644 --- a/internal/api/handler/default.go +++ b/internal/api/handler/default.go @@ -300,7 +300,11 @@ func (m ArcDefaultHandler) postTransaction(ctx echo.Context, params api.POSTTran // POSTTransaction ... func (m ArcDefaultHandler) POSTTransaction(ctx echo.Context, params api.POSTTransactionParams) (err error) { timeout := m.defaultTimeout - if params.XMaxTimeout != nil && *params.XMaxTimeout < metamorph.MaxTimeout { + if params.XMaxTimeout != nil { + if *params.XMaxTimeout > metamorph.MaxTimeout { + e := api.NewErrorFields(api.ErrStatusBadRequest, ErrMaxTimeoutExceeded.Error()) + return ctx.JSON(e.Status, e) + } timeout = time.Second * time.Duration(*params.XMaxTimeout) } @@ -483,7 +487,11 @@ func (m ArcDefaultHandler) postTransactions(ctx echo.Context, params api.POSTTra // POSTTransactions ... func (m ArcDefaultHandler) POSTTransactions(ctx echo.Context, params api.POSTTransactionsParams) (err error) { timeout := m.defaultTimeout - if params.XMaxTimeout != nil && *params.XMaxTimeout < metamorph.MaxTimeout { + if params.XMaxTimeout != nil { + if *params.XMaxTimeout > metamorph.MaxTimeout { + e := api.NewErrorFields(api.ErrStatusBadRequest, ErrMaxTimeoutExceeded.Error()) + return ctx.JSON(e.Status, e) + } timeout = time.Second * time.Duration(*params.XMaxTimeout) }