fix: add headers to http.HttpResponseBase constructor (#564)

* fix: add headers to http.HttpResponseBase constructor

fixes #563

* fix: correct Dict() with Dict[]

* feat: add ResponseHeaders typing

* fix: correct HttpResponseBase.headers type

* fix: add missing ...s

* fix: add CaseInsensitiveMapping import

* fix: make Dict -> Dict[str, str]
This commit is contained in:
Chas Nelson
2021-02-09 19:07:35 +00:00
committed by GitHub
parent 8f9e77ce39
commit e6dcfe4fc6

View File

@@ -6,24 +6,35 @@ from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Type, U
from django.core.handlers.wsgi import WSGIRequest
from django.http.cookie import SimpleCookie
from django.test.client import Client
from django.utils.datastructures import CaseInsensitiveMapping
from django.template import Context, Template
from django.urls import ResolverMatch
class BadHeaderError(ValueError): ...
class ResponseHeaders(CaseInsensitiveMapping):
store: Dict[str, str] = ...
def __init__(self, data: Dict[str, str]) -> None: ...
def _convert_to_charset(self, value: Union[bytes, str], charset: str, mime_encode: str=...) -> str: ...
def __delitem__(self, key: str) -> None: ...
def __setitem__(self, key: str, value: str) -> None: ...
def pop(self, key: str, default: Optional[str] = ...) -> str: ...
def setdefault(self, key: str, value: str) -> None: ...
class HttpResponseBase(Iterable[Any]):
status_code: int = ...
cookies: SimpleCookie = ...
reason_phrase: str = ...
charset: str = ...
closed: bool = ...
headers: ResponseHeaders = ...
def __init__(
self,
content_type: Optional[str] = ...,
status: Optional[int] = ...,
reason: Optional[str] = ...,
charset: Optional[str] = ...,
headers: Optional[Dict[str, str]] = ...,
) -> None: ...
def serialize_headers(self) -> bytes: ...
def __setitem__(self, header: Union[str, bytes], value: Union[str, bytes, int]) -> None: ...