Closed ljj038 closed 2 years ago
You can take another handler aas an argument. For example:
(defn wrap-random-surprise [handler surprise-handler]
(rand-nth [handler surprise-handler]))
Often additional handlers are used to respond to some unusual event, such as errors, authentication failures, etc.
@weavejester thank you for explain.
At first, I thought maybe there is a way to combine two or more handlers to one. But I can not found a way to do it.
now, I got it. It's like if else to choose one handler from handlers by some condition. not combine.
I read middleware examples, and I can get it that a middleware take one handler and return a new one.
but how can a middleware take more than one handlers and return a new handler?