當前位置: 首頁>>代碼示例>>Python>>正文


Python datastructures.EnvironHeaders方法代碼示例

本文整理匯總了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 
開發者ID:p1c2u,項目名稱:openapi-core,代碼行數:22,代碼來源:test_flask_requests.py

示例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 
開發者ID:p1c2u,項目名稱:openapi-core,代碼行數:25,代碼來源:test_flask_requests.py

示例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 
開發者ID:p1c2u,項目名稱:openapi-core,代碼行數:22,代碼來源:test_flask_requests.py


注:本文中的werkzeug.datastructures.EnvironHeaders方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。