示例#1
0
def http(string, handle_errors=True):
    app = zope.testbrowser.wsgi.Layer.get_app()
    if app is None:
        raise NotInBrowserLayer(NotInBrowserLayer.__doc__)

    request = TestRequest.from_file(StringIO(string))
    request.environ['wsgi.handleErrors'] = handle_errors
    response = request.get_response(app)
    return FakeResponse(response)
示例#2
0
def http(string, handle_errors=True):
    app = zope.testbrowser.wsgi.Layer.get_app()
    if app is None:
        raise NotInBrowserLayer(NotInBrowserLayer.__doc__)

    request = TestRequest.from_file(StringIO(string))
    request.environ["wsgi.handleErrors"] = handle_errors
    request.environ["HTTP_X_UVCSITE_REST"] = "service"
    response = request.get_response(app)
    return FakeResponse(response)
示例#3
0
def http(wsgi_app, string, handle_errors=True):
    request = TestRequest.from_file(BytesIO(string.lstrip()))
    request.environ['wsgi.handleErrors'] = handle_errors
    response = request.get_response(wsgi_app)
    return FakeResponse(response)
示例#4
0
def http(wsgi_app, string, handle_errors=True):
    request = TestRequest.from_file(BytesIO(string))
    request.environ['wsgi.handleErrors'] = handle_errors
    response = request.get_response(wsgi_app)
    return FakeResponse(response)