Exemplo n.º 1
0
def parser():
    on_headers = Mock()
    on_error = Mock()
    on_body = Mock()
    parser = impl_cffi.HttpRequestParser(on_headers, on_error, on_body)

    return parser
Exemplo n.º 2
0
def make_cffi(cb_factory):
    on_headers = cb_factory()
    on_error = cb_factory()
    on_body = cb_factory()
    parser_cffi = impl_cffi.HttpRequestParser(on_headers, on_body, on_error)

    return parser_cffi, on_headers, on_error, on_body
Exemplo n.º 3
0
def setup_cffi(dump=True):
    if dump:

        def on_headers(request):
            print('- header -')
            request.dump_headers()

        def on_error(reason):
            print('- error', reason)

        def on_body(request):
            print('- body -')
            print(request.body)
    else:

        def on_headers(request):
            pass

        def on_error(reason):
            pass

        def on_body(request):
            pass

    return impl_cffi.HttpRequestParser(on_headers, on_error, on_body)
Exemplo n.º 4
0
    def make_cffi():
        on_headers = Mock()
        on_error = Mock()
        on_body = Mock()
        parser_cffi = impl_cffi.HttpRequestParser(on_headers, on_body,
                                                  on_error)

        return parser_cffi, on_headers, on_error, on_body