python-hyper / hyper

HTTP/2 for Python.
http://hyper.rtfd.org/en/latest/
MIT License
1.05k stars 191 forks source link

Document how to detect http2 connection when using requests HTTP20Adapter adapter #388

Closed thenewguy closed 6 years ago

thenewguy commented 6 years ago

According to https://hyper.readthedocs.io/en/latest/quickstart.html#streams it is possible to know if the request was http2 or not.

Please document how to check this when using the requests integration via hyper.contrib.HTTP20Adapter

thenewguy commented 6 years ago

This turned out to be trivial

    def test_session_uses_http2(self):
        r = self.session.get(self.carrier_list_url)
        r.raise_for_status()
        self.assertIsInstance(r.raw, HTTP20Response)