mirror of
https://github.com/correl/openapi-core.git
synced 2024-11-21 19:18:41 +00:00
Case insensitive headers fix
This commit is contained in:
parent
753637d2d0
commit
ac5c6762d8
3 changed files with 10 additions and 6 deletions
|
@ -39,7 +39,7 @@ class DjangoOpenAPIRequestFactory(object):
|
|||
parameters = RequestParameters(
|
||||
path=path,
|
||||
query=request.GET,
|
||||
header=request.headers,
|
||||
header=request.headers.items(),
|
||||
cookie=request.COOKIES,
|
||||
)
|
||||
full_url_pattern = urljoin(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""OpenAPI core validation request datatypes module"""
|
||||
import attr
|
||||
from werkzeug.datastructures import ImmutableMultiDict
|
||||
from werkzeug.datastructures import ImmutableMultiDict, Headers
|
||||
|
||||
from openapi_core.validation.datatypes import BaseValidationResult
|
||||
|
||||
|
@ -13,14 +13,14 @@ class RequestParameters(object):
|
|||
query
|
||||
Query string parameters as MultiDict. Must support getlist method.
|
||||
header
|
||||
Request headers as dict.
|
||||
Request headers as Headers.
|
||||
cookie
|
||||
Request cookies as dict.
|
||||
path
|
||||
Path parameters as dict. Gets resolved against spec if empty.
|
||||
"""
|
||||
query = attr.ib(factory=ImmutableMultiDict)
|
||||
header = attr.ib(factory=dict)
|
||||
header = attr.ib(factory=Headers, converter=Headers)
|
||||
cookie = attr.ib(factory=dict)
|
||||
path = attr.ib(factory=dict)
|
||||
|
||||
|
|
|
@ -15,13 +15,17 @@ class TestHttpProvider(object):
|
|||
def provider(self, scheme):
|
||||
return HttpProvider(scheme)
|
||||
|
||||
def test_issue29427(self, provider):
|
||||
@pytest.mark.parametrize(
|
||||
'header',
|
||||
['authorization', 'Authorization', 'AUTHORIZATION'],
|
||||
)
|
||||
def test_header(self, provider, header):
|
||||
"""Tests HttpProvider against Issue29427
|
||||
https://bugs.python.org/issue29427
|
||||
"""
|
||||
jwt = 'MQ'
|
||||
headers = {
|
||||
'Authorization': 'Bearer {0}'.format(jwt),
|
||||
header: 'Bearer {0}'.format(jwt),
|
||||
}
|
||||
request = MockRequest(
|
||||
'http://localhost', 'GET', '/pets',
|
||||
|
|
Loading…
Reference in a new issue