test_inbound.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:yarpc-python 作者: yarpc 项目源码 文件源码
def test_inbound_headers(http_headers, rpc_headers, http_resp_headers):
    class Handler(object):
        def handle(self, request):
            assert rpc_headers == request.headers
            return Response(headers=rpc_headers, body=request.body)

    inbound = HTTPInbound()
    inbound.start(Handler())

    client = AsyncHTTPClient()
    req = HTTPRequest(
        url='http://localhost:%s' % inbound.port,
        method='POST',
        headers=http_headers,
        body='',
    )

    res = yield client.fetch(req)
    assert 200 == res.code
    for k, v in http_resp_headers.items():
        assert v == res.headers[k]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号