-
-
Notifications
You must be signed in to change notification settings - Fork 831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide request_class, response_class for httpx.Client #3199
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets have it ✌️
httpx/_client.py
Outdated
@@ -164,6 +164,7 @@ class BaseClient: | |||
def __init__( | |||
self, | |||
*, | |||
request_class: type[Request] | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably also response_class
, right?
Also I guess move this to the end of the parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably also response_class, right?
I thought about that, but baseclient has no logic related with responses, so response_class is now added only in Client for passing to transports. I can add response_class, if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to have it in BaseClient.
When constructing it from Client/AsyncClient/CustomClient, it will auto generate response_class
property for those. so to avoid duplicate codes on subclasses I think it's proper location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I also think it's good to have them on bottom)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
So we need or we can use Should also consider add a generic typing for response type and request type of client instance. |
|
return type of httpx.Reponse.raise_for_status still need to update |
Summary
Closes #717
Checklist