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.parser.errors import HttpParserError
|
||||
from multidict import CIMultiDict
|
||||
|
||||
from sanic.compat import Header
|
||||
from sanic.exceptions import (
|
||||
HeaderExpectationFailed,
|
||||
InvalidUsage,
|
||||
|
@ -304,7 +304,7 @@ class HttpProtocol(asyncio.Protocol):
|
|||
def on_headers_complete(self):
|
||||
self.request = self.request_class(
|
||||
url_bytes=self.url,
|
||||
headers=CIMultiDict(self.headers),
|
||||
headers=Header(self.headers),
|
||||
version=self.parser.get_http_version(),
|
||||
method=self.parser.get_method().decode(),
|
||||
transport=self.transport,
|
||||
|
|
2
setup.py
2
setup.py
|
@ -80,7 +80,7 @@ requirements = [
|
|||
uvloop,
|
||||
ujson,
|
||||
"aiofiles>=0.3.0",
|
||||
"websockets>=6.0,<7.0",
|
||||
"websockets>=7.0,<8.0",
|
||||
"multidict>=4.0,<5.0",
|
||||
"requests-async==0.5.0",
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue
Block a user