Пример #1
0
def application(environ, start_response):
    """Simple application for test purposes."""
    response_body = six.b('The request method was {0}'.format(environ['REQUEST_METHOD']))
    response_len = len(response_body)
    status = '200 OK'
    response_headers = [('Content-Type', 'text/plain'),
                        ('Content-Length', str(response_len))]

    start_response(status, response_headers)

    return Response(
        app_iter=AppIterRange([response_body], 0, response_len), headerlist=response_headers).app_iter
Пример #2
0
def test_app_iter_range_starts_after_iter_end():
    from webob.response import AppIterRange
    range = AppIterRange(iter([]), start=1, stop=1)
    assert list(range) == []