-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make init params of HttpRequest/HttpResponse kw-only except for url
- Loading branch information
Showing
3 changed files
with
14 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,12 +157,12 @@ class HttpRequest: | |
""" | ||
|
||
url: str = attrs.field() | ||
method: str = attrs.field(default="GET") | ||
method: str = attrs.field(default="GET", kw_only=True) | ||
headers: HttpRequestHeaders = attrs.field( | ||
factory=HttpRequestHeaders, converter=HttpRequestHeaders | ||
factory=HttpRequestHeaders, converter=HttpRequestHeaders, kw_only=True | ||
) | ||
body: HttpRequestBody = attrs.field( | ||
factory=HttpRequestBody, converter=HttpRequestBody | ||
factory=HttpRequestBody, converter=HttpRequestBody, kw_only=True | ||
) | ||
|
||
|
||
|
@@ -190,11 +190,12 @@ class HttpResponse: | |
""" | ||
|
||
url: str = attrs.field() | ||
body: HttpResponseBody = attrs.field(converter=HttpResponseBody) | ||
status: Optional[int] = attrs.field(default=None) | ||
body: HttpResponseBody = attrs.field(converter=HttpResponseBody, kw_only=True) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
BurnzZ
Author
Contributor
|
||
status: Optional[int] = attrs.field(default=None, kw_only=True) | ||
headers: HttpResponseHeaders = attrs.field(factory=HttpResponseHeaders, | ||
converter=HttpResponseHeaders) | ||
_encoding: Optional[str] = attrs.field(default=None) | ||
converter=HttpResponseHeaders, | ||
kw_only=True) | ||
_encoding: Optional[str] = attrs.field(default=None, kw_only=True) | ||
|
||
_DEFAULT_ENCODING = 'ascii' | ||
_cached_text: Optional[str] = None | ||
|
What do you think about keeping it positional @BurnzZ? It seems most responses have body, and this argument is required, unlike status, headers of encoding.