本文整理匯總了Python中werkzeug.datastructures.EnvironHeaders方法的典型用法代碼示例。如果您正苦於以下問題:Python datastructures.EnvironHeaders方法的具體用法?Python datastructures.EnvironHeaders怎麽用?Python datastructures.EnvironHeaders使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類werkzeug.datastructures
的用法示例。
在下文中一共展示了datastructures.EnvironHeaders方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_simple
# 需要導入模塊: from werkzeug import datastructures [as 別名]
# 或者: from werkzeug.datastructures import EnvironHeaders [as 別名]
def test_simple(self, request_factory, request):
request = request_factory('GET', '/', subdomain='www')
openapi_request = FlaskOpenAPIRequest(request)
path = {}
query = ImmutableMultiDict([])
headers = EnvironHeaders(request.environ)
cookies = {}
assert openapi_request.parameters == RequestParameters(
path=path,
query=query,
header=headers,
cookie=cookies,
)
assert openapi_request.method == request.method.lower()
assert openapi_request.full_url_pattern == \
urljoin(request.host_url, request.path)
assert openapi_request.body == request.data
assert openapi_request.mimetype == request.mimetype
示例2: test_multiple_values
# 需要導入模塊: from werkzeug import datastructures [as 別名]
# 或者: from werkzeug.datastructures import EnvironHeaders [as 別名]
def test_multiple_values(self, request_factory, request):
request = request_factory(
'GET', '/', subdomain='www', query_string='a=b&a=c')
openapi_request = FlaskOpenAPIRequest(request)
path = {}
query = ImmutableMultiDict([
('a', 'b'), ('a', 'c'),
])
headers = EnvironHeaders(request.environ)
cookies = {}
assert openapi_request.parameters == RequestParameters(
path=path,
query=query,
header=headers,
cookie=cookies,
)
assert openapi_request.method == request.method.lower()
assert openapi_request.full_url_pattern == \
urljoin(request.host_url, request.path)
assert openapi_request.body == request.data
assert openapi_request.mimetype == request.mimetype
示例3: test_url_rule
# 需要導入模塊: from werkzeug import datastructures [as 別名]
# 或者: from werkzeug.datastructures import EnvironHeaders [as 別名]
def test_url_rule(self, request_factory, request):
request = request_factory('GET', '/browse/12/', subdomain='kb')
openapi_request = FlaskOpenAPIRequest(request)
path = {'id': 12}
query = ImmutableMultiDict([])
headers = EnvironHeaders(request.environ)
cookies = {}
assert openapi_request.parameters == RequestParameters(
path=path,
query=query,
header=headers,
cookie=cookies,
)
assert openapi_request.method == request.method.lower()
assert openapi_request.full_url_pattern == \
urljoin(request.host_url, '/browse/{id}/')
assert openapi_request.body == request.data
assert openapi_request.mimetype == request.mimetype