bugfix: replace CIMultiDict with compat.Header in all places
This commit is contained in:
		| @@ -5,8 +5,7 @@ from inspect import isawaitable | ||||
| from typing import Any, Awaitable, Callable, MutableMapping, Union | ||||
| from urllib.parse import quote | ||||
|  | ||||
| from multidict import CIMultiDict | ||||
|  | ||||
| from sanic.compat import Header | ||||
| from sanic.exceptions import InvalidUsage, ServerError | ||||
| from sanic.log import logger | ||||
| from sanic.request import Request | ||||
| @@ -186,7 +185,7 @@ class ASGIApp: | ||||
|         instance.transport.add_task = sanic_app.loop.create_task | ||||
|         instance.transport.loop = sanic_app.loop | ||||
|  | ||||
|         headers = CIMultiDict( | ||||
|         headers = Header( | ||||
|             [ | ||||
|                 (key.decode("latin-1"), value.decode("latin-1")) | ||||
|                 for key, value in scope.get("headers", []) | ||||
|   | ||||
| @@ -2,6 +2,5 @@ from multidict import CIMultiDict | ||||
|  | ||||
|  | ||||
| class Header(CIMultiDict): | ||||
|  | ||||
| 	def get_all(self, key): | ||||
| 		return self.getall(key, []) | ||||
|     def get_all(self, key): | ||||
|         return self.getall(key, default=[]) | ||||
|   | ||||
| @@ -4,8 +4,8 @@ from os import path | ||||
| from urllib.parse import quote_plus | ||||
|  | ||||
| from aiofiles import open as open_async | ||||
| from multidict import CIMultiDict | ||||
|  | ||||
| from sanic.compat import Header | ||||
| from sanic.cookies import CookieJar | ||||
| from sanic.helpers import STATUS_CODES, has_message_body, remove_entity_headers | ||||
|  | ||||
| @@ -74,7 +74,7 @@ class StreamingHTTPResponse(BaseHTTPResponse): | ||||
|         self.content_type = content_type | ||||
|         self.streaming_fn = streaming_fn | ||||
|         self.status = status | ||||
|         self.headers = CIMultiDict(headers or {}) | ||||
|         self.headers = Header(headers or {}) | ||||
|         self.chunked = chunked | ||||
|         self._cookies = None | ||||
|  | ||||
| @@ -164,7 +164,7 @@ class HTTPResponse(BaseHTTPResponse): | ||||
|             self.body = body_bytes | ||||
|  | ||||
|         self.status = status | ||||
|         self.headers = CIMultiDict(headers or {}) | ||||
|         self.headers = Header(headers or {}) | ||||
|         self._cookies = None | ||||
|  | ||||
|     def output(self, version="1.1", keep_alive=False, keep_alive_timeout=None): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yun Xu
					Yun Xu