bugfix: fix incompatible api between multidict and websockets, and bump up websockets version to match uvicorn
This commit is contained in:
parent
84b41123f2
commit
b397637bb9
7
sanic/compat.py
Normal file
7
sanic/compat.py
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
from multidict import CIMultiDict
|
||||||
|
|
||||||
|
|
||||||
|
class Header(CIMultiDict):
|
||||||
|
|
||||||
|
def get_all(self, key):
|
||||||
|
return self.getall(key, [])
|
|
@ -12,8 +12,8 @@ from time import time
|
||||||
|
|
||||||
from httptools import HttpRequestParser
|
from httptools import HttpRequestParser
|
||||||
from httptools.parser.errors import HttpParserError
|
from httptools.parser.errors import HttpParserError
|
||||||
from multidict import CIMultiDict
|
|
||||||
|
|
||||||
|
from sanic.compat import Header
|
||||||
from sanic.exceptions import (
|
from sanic.exceptions import (
|
||||||
HeaderExpectationFailed,
|
HeaderExpectationFailed,
|
||||||
InvalidUsage,
|
InvalidUsage,
|
||||||
|
@ -304,7 +304,7 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
def on_headers_complete(self):
|
def on_headers_complete(self):
|
||||||
self.request = self.request_class(
|
self.request = self.request_class(
|
||||||
url_bytes=self.url,
|
url_bytes=self.url,
|
||||||
headers=CIMultiDict(self.headers),
|
headers=Header(self.headers),
|
||||||
version=self.parser.get_http_version(),
|
version=self.parser.get_http_version(),
|
||||||
method=self.parser.get_method().decode(),
|
method=self.parser.get_method().decode(),
|
||||||
transport=self.transport,
|
transport=self.transport,
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -80,7 +80,7 @@ requirements = [
|
||||||
uvloop,
|
uvloop,
|
||||||
ujson,
|
ujson,
|
||||||
"aiofiles>=0.3.0",
|
"aiofiles>=0.3.0",
|
||||||
"websockets>=6.0,<7.0",
|
"websockets>=7.0,<8.0",
|
||||||
"multidict>=4.0,<5.0",
|
"multidict>=4.0,<5.0",
|
||||||
"requests-async==0.5.0",
|
"requests-async==0.5.0",
|
||||||
]
|
]
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -19,7 +19,7 @@ deps =
|
||||||
gunicorn
|
gunicorn
|
||||||
pytest-benchmark
|
pytest-benchmark
|
||||||
uvicorn
|
uvicorn
|
||||||
websockets>=6.0,<7.0
|
websockets>=7.0,<8.0
|
||||||
commands =
|
commands =
|
||||||
pytest {posargs:tests --cov sanic}
|
pytest {posargs:tests --cov sanic}
|
||||||
- coverage combine --append
|
- coverage combine --append
|
||||||
|
|
Loading…
Reference in New Issue
Block a user