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
Currently the Mux prioritizes the Handler with the most specific Path, but if multiple Handlers are registered with the same Path, but with different criteria such as ContentType, the selected handler is undefined.
For example, I want a generic handler for a specific Host, and a more specific handler for a specific content type. If the content type matches, I want that more specific handler to be selected.
I suggest returning an additional parameter from ResponseMatcher.match that is the number of matching criteria. When selecting a ResponseMatcher in Mux.Handle the handler with the highest number of matching criteria should be selected. The path length can then be used as a tie breaker.
This would change behavior slightly in some cases, but mostly only where the behavior was already undefined.
The text was updated successfully, but these errors were encountered:
Currently the Mux prioritizes the Handler with the most specific Path, but if multiple Handlers are registered with the same Path, but with different criteria such as ContentType, the selected handler is undefined.
For example, I want a generic handler for a specific Host, and a more specific handler for a specific content type. If the content type matches, I want that more specific handler to be selected.
I suggest returning an additional parameter from
ResponseMatcher.match
that is the number of matching criteria. When selecting aResponseMatcher
inMux.Handle
the handler with the highest number of matching criteria should be selected. The path length can then be used as a tie breaker.This would change behavior slightly in some cases, but mostly only where the behavior was already undefined.
The text was updated successfully, but these errors were encountered: