Changeset a4e136a in mod_gnutls


Ignore:
Timestamp:
Dec 1, 2019, 10:10:21 AM (3 years ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio, main, master, proxy-ticket
Children:
096859f
Parents:
d5f5356
Message:

https-test-client.py: Allow overriding headers

Location:
test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/https-test-client.py

    rd5f5356 ra4e136a  
    6868class TestRequest(yaml.YAMLObject):
    6969    yaml_tag = '!request'
    70     def __init__(self, path, expect=dict(status=200), method='GET'):
     70    def __init__(self, path, method='GET', headers=dict(),
     71                 expect=dict(status=200)):
    7172        self.method = method
    7273        self.path = path
     74        self.headers = headers
    7375        self.expect = expect
    7476
    7577    def __repr__(self):
    7678        return (f'{self.__class__.__name__!s}(path={self.path!r}, '
    77                 f'expect={self.expect!r}, method={self.method!r})')
     79                f'method={self.method!r}), headers={self.headers!r}, '
     80                f'expect={self.expect!r}')
    7881
    7982    def check_response(self, response, body):
     
    195198                # Add headers={'Host': 'test.host'} to provoke "421
    196199                # Misdirected
    197                 conn.request(act.method, act.path)
     200                conn.request(act.method, act.path, headers=act.headers)
    198201                resp = conn.getresponse()
    199202                body = resp.read().decode()
  • test/sample_test.yml

    rd5f5356 ra4e136a  
    55  - !request
    66    path: /
     7    headers:
     8      Host: localhost
    79    expect:
    810      status: 404
Note: See TracChangeset for help on using the changeset viewer.