Skip to content

Commit

Permalink
Allow leading spaces in http() requests
Browse files Browse the repository at this point in the history
zope.app.testing.functional.HTTPCaller allowed you to write

    >>> print http(r"""
    ... GET / HTTP/1.1
    ... Headers: headers etc.
    ... """)

I don't see why zope.app.wsgi.testlayer.http() can't do the same.

This makes porting large ancient test suites easier.
  • Loading branch information
mgedmin committed Jun 6, 2019
1 parent f2cfd0d commit 01ccf3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/zope/app/wsgi/testlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def __str__(self):


def http(wsgi_app, string, handle_errors=True):
request = TestRequest.from_file(BytesIO(string))
request = TestRequest.from_file(BytesIO(string.lstrip()))
request.environ['wsgi.handleErrors'] = handle_errors
response = request.get_response(wsgi_app)
return FakeResponse(response)
Expand Down

0 comments on commit 01ccf3f

Please sign in to comment.