You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While studying the wild-workouts-go-ddd-example, I noticed a small issue in the RunHTTPServerOnAddr method within internal/common/server/http.go at line 24. The createHandler parameter is a function that requires using the provided router parameter and returning a http.Handler.
I observed that in the test cases and main.go file, the method passed as an argument is:
This function returns ports.HandlerFromMux(ports.NewHttpServer(app), router), where ports.HandlerFromMux
internally returns the router passed to it. In other words, the result obtained by createHandler(router) is the router itself,
processed and returned by the same router. This leads to a potential issue when executing the following code:
It results in mounting the router under its own "/api" route, causing an infinite loop when recursively iterating over the child routes.
To address this, it may be necessary to revisit how the createHandler function is implemented or applied, ensuring that it does not lead to unintended recursive mounting of the router under its own route.
The text was updated successfully, but these errors were encountered:
While studying the wild-workouts-go-ddd-example, I noticed a small issue in the
RunHTTPServerOnAddr
method within internal/common/server/http.go at line 24. ThecreateHandler
parameter is a function that requires using the provided router parameter and returning a http.Handler.I observed that in the test cases and main.go file, the method passed as an argument is:
This function returns
ports.HandlerFromMux(ports.NewHttpServer(app), router)
, whereports.HandlerFromMux
internally returns the router passed to it. In other words, the result obtained by
createHandler(router)
is the router itself,processed and returned by the same router. This leads to a potential issue when executing the following code:
rootRouter.Mount("/api", createHandler(apiRouter))
It results in mounting the router under its own "/api" route, causing an infinite loop when recursively iterating over the child routes.
To address this, it may be necessary to revisit how the createHandler function is implemented or applied, ensuring that it does not lead to unintended recursive mounting of the router under its own route.
The text was updated successfully, but these errors were encountered: