当前位置: 首页>>代码示例>>Python>>正文


Python Response.headers['Content-Type']方法代码示例

本文整理汇总了Python中aspen.Response.headers['Content-Type']方法的典型用法代码示例。如果您正苦于以下问题:Python Response.headers['Content-Type']方法的具体用法?Python Response.headers['Content-Type']怎么用?Python Response.headers['Content-Type']使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在aspen.Response的用法示例。


在下文中一共展示了Response.headers['Content-Type']方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_response_doesnt_reset_content_type_when_negotiating

# 需要导入模块: from aspen import Response [as 别名]
# 或者: from aspen.Response import headers['Content-Type'] [as 别名]
def test_get_response_doesnt_reset_content_type_when_negotiating():
    mk(('index', NEGOTIATED_RESOURCE))
    request = StubRequest.from_fs('index')
    request.headers['Accept'] = 'text/html'
    response = Response()
    response.headers['Content-Type'] = 'never/mind'
    actual = get_response(request, response).headers['Content-Type']
    response = Response()
    response.headers['Content-Type'] = 'never/mind'
    actual = get_response(request, response).headers['Content-Type']
    assert actual == "never/mind", actual
开发者ID:jarpineh,项目名称:aspen,代码行数:13,代码来源:test_negotiated_resource.py

示例2: test_get_response_doesnt_reset_content_type_when_negotiating

# 需要导入模块: from aspen import Response [as 别名]
# 或者: from aspen.Response import headers['Content-Type'] [as 别名]
def test_get_response_doesnt_reset_content_type_when_negotiating(harness):
    harness.fs.www.mk(('index.spt', NEGOTIATED_RESOURCE))
    request = harness.make_request(filepath='index.spt', contents=NEGOTIATED_RESOURCE)
    request.headers['Accept'] = 'text/html'
    response = Response()
    response.headers['Content-Type'] = 'never/mind'
    actual = get_response(request, response).headers['Content-Type']
    response = Response()
    response.headers['Content-Type'] = 'never/mind'
    actual = get_response(request, response).headers['Content-Type']
    assert actual == "never/mind"
开发者ID:BigBlueHat,项目名称:aspen-python,代码行数:13,代码来源:test_negotiated_resource.py

示例3: test_respond_doesnt_reset_content_type_when_negotiating

# 需要导入模块: from aspen import Response [as 别名]
# 或者: from aspen.Response import headers['Content-Type'] [as 别名]
def test_respond_doesnt_reset_content_type_when_negotiating(harness):
    harness.fs.www.mk(('index.spt', SIMPLATE))
    state = _get_state(harness, filepath='index.spt', contents=SIMPLATE)
    state['request'].headers['Accept'] = 'text/html'
    response = Response()
    response.headers['Content-Type'] = 'never/mind'
    state['response'] = response
    actual = _respond(state).headers['Content-Type']
    response = Response()
    response.headers['Content-Type'] = 'never/mind'
    state['response'] = response
    actual = _respond(state).headers['Content-Type']
    assert actual == "never/mind"
开发者ID:jaraco,项目名称:aspen,代码行数:15,代码来源:test_dynamic_resource.py

示例4: test_get_response_doesnt_reset_content_type_when_not_negotiating

# 需要导入模块: from aspen import Response [as 别名]
# 或者: from aspen.Response import headers['Content-Type'] [as 别名]
def test_get_response_doesnt_reset_content_type_when_not_negotiating(harness):
    harness.fs.www.mk(('index.spt', NEGOTIATED_RESOURCE))
    state = get_state(harness, filepath='index.spt', contents=NEGOTIATED_RESOURCE)
    response = Response()
    response.headers['Content-Type'] = 'never/mind'
    actual = get_response(state, response).headers['Content-Type']
    assert actual == "never/mind"
开发者ID:Acidburn0zzz,项目名称:aspen-python,代码行数:9,代码来源:test_negotiated_resource.py


注:本文中的aspen.Response.headers['Content-Type']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。