Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Documentation proposes an example that does not work. #286

Closed
@Lukasa

Description

@Lukasa

The quickstart guide includes this example:

>>> from hyper import HTTPConnection
>>> c = HTTPConnection('http2bin.org')
>>> first = c.request('GET', '/get', headers={'key': 'value'})
>>> second = c.request('POST', '/post', body=b'hello')
>>> third = c.request('GET', '/ip')
>>> second_response = c.get_response(second)
>>> first_response = c.get_response(first)
>>> third_response = c.get_response(third)

This example is fundamentally flawed, because before you know you have a HTTP/2 connection you cannot safely send multiple requests down it. In the first instance, we can fix this by using port 443 in the constructor. We may also want to add a formalised API for working out what protocol version you're working with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions