Open Jay-Madden opened 4 months ago
hey @Jay-Madden - this isn’t directly supported. I’d probably approach this by using RouteToHandler
and keeping track of the requests myself or by using AppendHandlers
as you are.
if you see this pattern a lot you could implement a custom shim handler that takes an array of handlers and manages the ordering for you - then pass that handler on to RouteToHandler
. I could share an example if that would be helpful.
Gotcha @onsi We can roll something up.
As a note, is there any interest in a feature addition/pr for soemthing like this assuming a workable design can be thought out?
hey sorry for the delay. if you come up with a pattern you like that’s also backward compatible i’d love to take a PR for this - thanks!
For example I have routes:
I would like
/foo/bar
to respond to the first request to that url with{"data": 1}
and the second request with{"data": 2}
I would like
/baz/bax
to respond to the first request to that url with{"data2": 3}
and the second request with{"data2": 4}
I could not find a way to achieve this in the docs and am currently doing it via
.AppendHandlers
and putting all routes in there with verifies