本文整理汇总了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
示例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"
示例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"
示例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"