diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-10-07 10:30:38 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-10-07 11:15:19 +0200 |
commit | 2e5b690e84fd168ba169c17581f59b8e1d1f430e (patch) | |
tree | 8239ed9531e9e5b41af1468f123092037c7ec5eb /src/hydrilla/proxy/http_messages.py | |
parent | 48f80ae480e2fc0eabbdb5041e841b80c0f788f4 (diff) | |
download | haketilo-hydrilla-2e5b690e84fd168ba169c17581f59b8e1d1f430e.tar.gz haketilo-hydrilla-2e5b690e84fd168ba169c17581f59b8e1d1f430e.zip |
[proxy] support unrestricted HTTP requests API in Haketilo payloads
Diffstat (limited to 'src/hydrilla/proxy/http_messages.py')
-rw-r--r-- | src/hydrilla/proxy/http_messages.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/hydrilla/proxy/http_messages.py b/src/hydrilla/proxy/http_messages.py index 698020d..53d10db 100644 --- a/src/hydrilla/proxy/http_messages.py +++ b/src/hydrilla/proxy/http_messages.py @@ -44,7 +44,7 @@ else: from .. import url_patterns -DefaultGetValue = t.TypeVar('DefaultGetValue', object, None) +DefaultGetValue = t.TypeVar('DefaultGetValue', str, None) class IHeaders(Protocol): """....""" @@ -52,8 +52,13 @@ class IHeaders(Protocol): def get_all(self, key: str) -> t.Iterable[str]: ... - def get(self, key: str, default: DefaultGetValue = None) \ - -> t.Union[str, DefaultGetValue]: ... + @t.overload + def get(self, key: str) -> t.Optional[str]: + ... + @t.overload + def get(self, key: str, default: DefaultGetValue) \ + -> t.Union[str, DefaultGetValue]: + ... def items(self) -> t.Iterable[tuple[str, str]]: ... @@ -99,6 +104,7 @@ class ProducedResponse: class ResponseInfo: """....""" url: url_patterns.ParsedUrl + orig_url: url_patterns.ParsedUrl status_code: int headers: IHeaders body: bytes |