We should allow clients to trivially plug into WSGI and ASGI apps. This will allow: * Using `httpcore` as a test client. * Stubbing out third-party-services during tests, rather than making live network requests. We should support the following: ```python def hello_world(environ, start_response): ... client = Client(app=hello_world) ``` And... ```python async def hello_world(scope, receive, send): ... client = Client(app=hello_world) ``` This is easy enough for us to do, since we've already got a `dispatch=...` interface, so we'll want something like this: ```python if app is not None: if is_coroutine(app): dispatch = ASGIDispatcher(app) else: dispatch = WSGIDispatcher(app) ``` We'll then need `ASGIDispatcher` and `WSGIDispatcher` implementations, which implement `Dispatcher.send()`.
Activity
lovelydinosaur commentedon May 24, 2019
Related #79 - required for the WSGI case.
lovelydinosaur commentedon Jun 24, 2019
Done.