nirum-lang / nirum-python

The Nirum runtime library for Python
https://nirum.org/docs/target/python.html
MIT License
8 stars 9 forks source link

Add ways to filter (or hook) request/response objects #46

Open kanghyojun opened 7 years ago

kanghyojun commented 7 years ago

For more flexibility on transport layer, we need ways to filter (or hook) request/response objects:

kanghyojun commented 7 years ago

DONE

dahlia commented 7 years ago

It actually isn't done yet. We thought there should be 4 extension points i.e. (requests, response) × (client, server), but there currently are only two hooks (Client.make_request() and WsgiApp.make_response()).

In particular, response hook on client-side is necessary to extend transport layer. Because there's no extension point to urllib.request (that Client uses in the underlying) whereas server-side hooks can be replaced by WSGI middlewares. In fact, we are okay even if there are no server-side hooks.