We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
func (ep *getProductsEndpoint) handler() echo.HandlerFunc { return func(c echo.Context) error { ctx := c.Request().Context() ep.CatalogsMetrics.GetProductsHttpRequests.Add(ctx, 1)
fmt.Println("Raw query parameters:", c.QueryParams()) listQuery, err := utils.GetListQueryFromCtx(c) if err != nil { badRequestErr := customErrors.NewBadRequestErrorWrap( err, "[getProductsEndpoint_handler.GetListQueryFromCtx] error in getting data from query string", ) ep.Logger.Errorf( fmt.Sprintf( "[getProductsEndpoint_handler.GetListQueryFromCtx] err: %v", badRequestErr, ), ) return err } request := &dtos.GetProductsRequestDto{ListQuery: listQuery} if err := c.Bind(request); err != nil { badRequestErr := customErrors.NewBadRequestErrorWrap( err, "[getProductsEndpoint_handler.Bind] error in the binding request", ) ep.Logger.Errorf( fmt.Sprintf("[getProductsEndpoint_handler.Bind] err: %v", badRequestErr), ) return badRequestErr } query, err := queries.NewGetProducts(request.ListQuery) if err != nil { return err } queryResult, err := mediatr.Send[*queries.GetProducts, *dtos.GetProductsResponseDto]( ctx, query, ) if err != nil { err = errors.WithMessage( err, "[getProductsEndpoint_handler.Send] error in sending GetProducts", ) ep.Logger.Error(fmt.Sprintf("[getProductsEndpoint_handler.Send] err: {%v}", err)) return err } return c.JSON(http.StatusOK, queryResult) }
}
http://localhost:7000/api/v1/products?size=10&page=1&filters={field:price,value:100,comparison:eq} i m getting this error { "status": 400, "title": "Bad Request", "detail": "[getProductsEndpoint_handler.Bind] error in the binding request: code=400, message=unknown type, internal=unknown type", "type": "https://httpstatuses.io/400", "timestamp": "2024-07-03T18:36:30.959922+05:00", "stackTrace": "code=400, message=unknown type, internal=unknown type\n[getProductsEndpoint_handler.Bind] error in the binding request\ngithub.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors.NewBadRequestErrorWrap\n\t/Users/usamasaif/Desktop/go-food-delivery-microservices/internal/pkg/http/http_errors/custom_errors/bad_request_error.go:22\ngithub.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/getting_products/v1/endpoints.(*getProductsEndpoint).MapEndpoint.(*getProductsEndpoint).handler.func1\n\t/Users/usamasaif/Desktop/go-food-delivery-microservices/internal/services/catalog_write_service/internal/products/features/getting_products/v1/endpoints/get_products_endpoint.go:66\ngithub.com/labstack/echo/v4.(*Echo).add.func1\n\t/Users/usamasaif/Documents/go/pkg/mod/github.com/labstack/echo/[email protected]/echo.go:582\ngithub.com/labstack/echo/v4/middleware.GzipWithConfig.func1.1\n\t/Users/usamasaif/Documents/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/compress.go:140\ngithub.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo.(*echoHttpServer).SetupDefaultMiddlewares.RequestID.RequestIDWithConfig.func5.1\n\t/Users/usamasaif/Documents/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/request_id.go:70\ngithub.com/labstack/echo/v4/middleware.BodyLimitWithConfig.func1.1\n\t/Users/usamasaif/Documents/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/body_limit.go:87\ngithub.com/labstack/echo/v4/middleware.RequestLoggerConfig.ToMiddleware.func1.1\n\t/Users/usamasaif/Documents/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/request_logger.go:259\ngithub.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/middlewares/otel_metrics.Middleware.func1.1\n\t/Users/usamasaif/Desktop/go-food-delivery-microservices/internal/pkg/http/custom_echo/middlewares/otel_metrics/request_status_middleware.go:32\ngo.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho.Middleware.func1.1\n\t/Users/usamasaif/Documents/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/[email protected]/echo.go:92\ngithub.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo.(*echoHttpServer).SetupDefaultMiddlewares.EchoLogger.func4.1\n\t/Users/usamasaif/Desktop/go-food-delivery-microservices/internal/pkg/http/custom_echo/middlewares/log/log_middleware.go:17\ngithub.com/labstack/echo/v4.(*Echo).ServeHTTP\n\t/Users/usamasaif/Documents/go/pkg/mod/github.com/labstack/echo/[email protected]/echo.go:669\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:3137\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:2039\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1695\n" }
The text was updated successfully, but these errors were encountered:
Welcome to go-ecommerce-microservices. Thank you for reporting your first issue. Please check out our contributor guide.
Sorry, something went wrong.
No branches or pull requests
func (ep *getProductsEndpoint) handler() echo.HandlerFunc {
return func(c echo.Context) error {
ctx := c.Request().Context()
ep.CatalogsMetrics.GetProductsHttpRequests.Add(ctx, 1)
}
http://localhost:7000/api/v1/products?size=10&page=1&filters={field:price,value:100,comparison:eq}
i m getting this error
{
"status": 400,
"title": "Bad Request",
"detail": "[getProductsEndpoint_handler.Bind] error in the binding request: code=400, message=unknown type, internal=unknown type",
"type": "https://httpstatuses.io/400",
"timestamp": "2024-07-03T18:36:30.959922+05:00",
"stackTrace": "code=400, message=unknown type, internal=unknown type\n[getProductsEndpoint_handler.Bind] error in the binding request\ngithub.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors.NewBadRequestErrorWrap\n\t/Users/usamasaif/Desktop/go-food-delivery-microservices/internal/pkg/http/http_errors/custom_errors/bad_request_error.go:22\ngithub.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/getting_products/v1/endpoints.(*getProductsEndpoint).MapEndpoint.(*getProductsEndpoint).handler.func1\n\t/Users/usamasaif/Desktop/go-food-delivery-microservices/internal/services/catalog_write_service/internal/products/features/getting_products/v1/endpoints/get_products_endpoint.go:66\ngithub.com/labstack/echo/v4.(*Echo).add.func1\n\t/Users/usamasaif/Documents/go/pkg/mod/github.com/labstack/echo/[email protected]/echo.go:582\ngithub.com/labstack/echo/v4/middleware.GzipWithConfig.func1.1\n\t/Users/usamasaif/Documents/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/compress.go:140\ngithub.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo.(*echoHttpServer).SetupDefaultMiddlewares.RequestID.RequestIDWithConfig.func5.1\n\t/Users/usamasaif/Documents/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/request_id.go:70\ngithub.com/labstack/echo/v4/middleware.BodyLimitWithConfig.func1.1\n\t/Users/usamasaif/Documents/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/body_limit.go:87\ngithub.com/labstack/echo/v4/middleware.RequestLoggerConfig.ToMiddleware.func1.1\n\t/Users/usamasaif/Documents/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/request_logger.go:259\ngithub.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/middlewares/otel_metrics.Middleware.func1.1\n\t/Users/usamasaif/Desktop/go-food-delivery-microservices/internal/pkg/http/custom_echo/middlewares/otel_metrics/request_status_middleware.go:32\ngo.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho.Middleware.func1.1\n\t/Users/usamasaif/Documents/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/[email protected]/echo.go:92\ngithub.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo.(*echoHttpServer).SetupDefaultMiddlewares.EchoLogger.func4.1\n\t/Users/usamasaif/Desktop/go-food-delivery-microservices/internal/pkg/http/custom_echo/middlewares/log/log_middleware.go:17\ngithub.com/labstack/echo/v4.(*Echo).ServeHTTP\n\t/Users/usamasaif/Documents/go/pkg/mod/github.com/labstack/echo/[email protected]/echo.go:669\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:3137\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:2039\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1695\n"
}
The text was updated successfully, but these errors were encountered: