go-chi/chi

Greedy Parameter support

dgr237 opened this issue · 1 comments

dgr237 commented

I am trying to build a route which supports Greedy URL Parameter i.e. {Key+} will set the URL Param to a whole subset of paths. I also need to be able to distinguish:

/{Key+} from /{Key+}?SubOperation

I have tried using /* and /*?SubOperation and then manually extract the path in a middleware but chi complains that * has to be the end of the Uri.

Please advise on how I can achieve the above using chi?

you can try just /* and use chi.URLParam("*") for the url parameter (the Key) in your case. Then for the query parameter which is ?SubOperation, use request.Query().Get("SubOperation") where request is the *http.Request