Ejemplo n.º 1
0
def test_assemble_request():
    assert assemble_request(treq()) == (b"GET /path HTTP/1.1\r\n"
                                        b"header: qvalue\r\n"
                                        b"content-length: 7\r\n"
                                        b"host: address:22\r\n"
                                        b"\r\n"
                                        b"content")

    with raises(HttpException):
        assemble_request(treq(content=None))
Ejemplo n.º 2
0
def test_assemble_request():
    c = assemble_request(treq()) == (b"GET /path HTTP/1.1\r\n"
                                     b"header: qvalue\r\n"
                                     b"Host: address:22\r\n"
                                     b"Content-Length: 7\r\n"
                                     b"\r\n"
                                     b"content")

    with raises(HttpException):
        assemble_request(treq(content=CONTENT_MISSING))
Ejemplo n.º 3
0
def test_assemble_request():
    c = assemble_request(treq()) == (
        b"GET /path HTTP/1.1\r\n"
        b"header: qvalue\r\n"
        b"Host: address:22\r\n"
        b"Content-Length: 7\r\n"
        b"\r\n"
        b"content"
    )

    with raises(HttpException):
        assemble_request(treq(content=CONTENT_MISSING))
Ejemplo n.º 4
0
def test_assemble_request():
    assert assemble_request(treq()) == (
        b"GET /path HTTP/1.1\r\n"
        b"header: qvalue\r\n"
        b"content-length: 7\r\n"
        b"host: address:22\r\n"
        b"\r\n"
        b"content"
    )

    with raises(HttpException):
        assemble_request(treq(content=None))
Ejemplo n.º 5
0
def response(context, flow):
    print("================================================================")
    print(flow.request.url + ' ' + datetime.now().strftime("%Y/%m/%d %H:%M:%S"))
    print("================================================================")
    print(assemble.assemble_request(flow.request))
    print("================================================================")
    print(assemble.assemble_response(flow.response))
    print("================================================================")