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
type RouteHandlerMiddleware func(rw http.ResponseWriter, r *http.Request, reqVals RequestVals, next RouteRequestHandler)
When adding RouteHandlerMiddleware, the RouteSpec within RequestVals is difficult to use safely given the path template of a RouteSpec is a construction of:
the server's configured context path
other subrouter paths
the path of the endpoint of interest
Upon my first attempt at writing a RouteHandlerMiddleware, ensuring I matched a specific endpoint proved challenging - I had to choose between either taking an implicit assumption on witchcraft-go-server's usage of the context-path configuration point (I guess this is a pretty safe assumption) or just matching the path using strings.HasSuffix. I am unsure if there's something a little more ergonomic to provide users here.
Separate issue: when used in conjunction with conjure-go generated server code, an additional snag is having to copy the string literal for the route from the generated server code. Perhaps a separate ergonomics improvement there is defining those string literal paths as exported constants in conjure-go-generated code
The text was updated successfully, but these errors were encountered:
Existing method signature:
When adding RouteHandlerMiddleware, the RouteSpec within RequestVals is difficult to use safely given the path template of a RouteSpec is a construction of:
Upon my first attempt at writing a RouteHandlerMiddleware, ensuring I matched a specific endpoint proved challenging - I had to choose between either taking an implicit assumption on witchcraft-go-server's usage of the context-path configuration point (I guess this is a pretty safe assumption) or just matching the path using
strings.HasSuffix
. I am unsure if there's something a little more ergonomic to provide users here.Separate issue: when used in conjunction with conjure-go generated server code, an additional snag is having to copy the string literal for the route from the generated server code. Perhaps a separate ergonomics improvement there is defining those string literal paths as exported constants in conjure-go-generated code
The text was updated successfully, but these errors were encountered: