test_app.py 文件源码

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

项目:chalice 作者: aws 项目源码 文件源码
def test_can_return_text_even_with_binary_content_type_configured(
        create_event):
    demo = app.Chalice('demo-app')

    @demo.route('/index')
    def index_view():
        return app.Response(
            status_code=200,
            body='Plain text',
            headers={'Content-Type': 'text/plain'})

    event = create_event('/index', 'GET', {})
    event['headers']['Accept'] = 'application/octet-stream'
    response = demo(event, context=None)
    assert response['statusCode'] == 200
    assert response['body'] == 'Plain text'
    assert response['headers']['Content-Type'] == 'text/plain'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号