本文整理汇总了Python中hyper.common.headers.HTTPHeaderMap.merge方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPHeaderMap.merge方法的具体用法?Python HTTPHeaderMap.merge怎么用?Python HTTPHeaderMap.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hyper.common.headers.HTTPHeaderMap
的用法示例。
在下文中一共展示了HTTPHeaderMap.merge方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_merge_header_map_dict
# 需要导入模块: from hyper.common.headers import HTTPHeaderMap [as 别名]
# 或者: from hyper.common.headers.HTTPHeaderMap import merge [as 别名]
def test_merge_header_map_dict(self):
h = HTTPHeaderMap([(b'hi', b'there')])
d = {'cat': 'dog'}
h.merge(d)
assert list(h.items()) == [
(b'hi', b'there'),
(b'cat', b'dog'),
]
示例2: test_merge_headermaps_preserves_raw
# 需要导入模块: from hyper.common.headers import HTTPHeaderMap [as 别名]
# 或者: from hyper.common.headers.HTTPHeaderMap import merge [as 别名]
def test_merge_headermaps_preserves_raw(self):
h1 = HTTPHeaderMap([
(b'hi', b'there')
])
h2 = HTTPHeaderMap([
(b'Hi', b'there, sir, maam')
])
h1.merge(h2)
assert list(h1.iter_raw()) == [
(b'hi', b'there'),
(b'Hi', b'there, sir, maam'),
]
示例3: test_merge_self_is_no_op
# 需要导入模块: from hyper.common.headers import HTTPHeaderMap [as 别名]
# 或者: from hyper.common.headers.HTTPHeaderMap import merge [as 别名]
def test_merge_self_is_no_op(self):
h = HTTPHeaderMap([(b'hi', b'there')])
h.merge(h)
assert h == HTTPHeaderMap([(b'hi', b'there')])