/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_http_response.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-07 02:14:30 UTC
  • mto: This revision was merged to the branch mainline in revision 7492.
  • Revision ID: jelmer@jelmer.uk-20200207021430-m49iq3x4x8xlib6x
Drop python2 support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
  InvalidHttpResponse.
38
38
"""
39
39
 
40
 
try:
41
 
    import http.client as http_client
42
 
except ImportError:  # python < 3 without future
43
 
    import httplib as http_client
44
 
 
45
 
try:
46
 
    parse_headers = http_client.parse_headers
47
 
except AttributeError:  # python 2
48
 
    parse_headers = http_client.HTTPMessage
 
40
from io import BytesIO
 
41
 
 
42
import http.client as http_client
 
43
 
 
44
parse_headers = http_client.parse_headers
49
45
 
50
46
from .. import (
51
47
    errors,
52
48
    tests,
53
49
    )
54
 
from ..sixish import (
55
 
    BytesIO,
56
 
    PY3,
57
 
    )
58
50
from ..transport.http import (
59
51
    response,
60
52
    HTTPConnection,
726
718
        # Get rid of the status line
727
719
        status_and_headers.readline()
728
720
        msg = parse_headers(status_and_headers)
729
 
        if PY3:
730
 
            return msg.get
731
 
        else:
732
 
            return msg.getheader
 
721
        return msg.get
733
722
 
734
723
    def get_response(self, a_response):
735
724
        """Process a supplied response, and return the result."""