rpc-codec icon indicating copy to clipboard operation
rpc-codec copied to clipboard

Middleware support

Open dennypenta opened this issue 5 years ago • 3 comments

Does the project have the support of middlewares? So if not - I can implement it. Now I can just wrap around ServeHTTP function, but sometimes I wanna choose a group to wrap it.

dennypenta avatar Feb 25 '19 10:02 dennypenta

You can add your middlewares by wrapping jsonrpc2.HTTPHandler, like this:

http.Handle("/rpc", yourMiddleware1(yourMiddleware2(jsonrpc2.HTTPHandler(nil))))

Can you please explain what else do you need?

powerman avatar Feb 25 '19 12:02 powerman

For example, I have 10 handlers and I need to wrap only 5. This way won't work.

dennypenta avatar Feb 25 '19 14:02 dennypenta

I don't understand what you mean and how it may not work. You may explain in Russian if you like to.

powerman avatar Feb 25 '19 14:02 powerman