Skip to content
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

Custom httpx.AsyncClient kwargs usage #25

Open
ivasio opened this issue May 5, 2021 · 1 comment
Open

Custom httpx.AsyncClient kwargs usage #25

ivasio opened this issue May 5, 2021 · 1 comment

Comments

@ivasio
Copy link

ivasio commented May 5, 2021

Hi! Thanks a lot for the project!

I'm trying to generate a client lib using this tool and I'm facing some issues, specifically with setting custom headers for the request. I don't have any experience using httpx so far, but looks like setting these headers when instantiating httpx.AsyncClient and using them afterwards makes perfect sense. But for some reason at https://github.com/dmontagu/fastapi_client/blob/master/openapi-python-templates/api_client.mustache#L56 httpx.Request is instantiated directly and no headers are proxied from httpx.AsyncClient. Using self._async_client.build_request at this line has solved the problem and I'd like to pull request it

Is there anything wrong with it? Or I can pull request?

@colindjk
Copy link

colindjk commented Jul 6, 2021

bump.

This issue makes the generated code unusable for any API involving headers authentication. (without code modification ofc).

@ivasio I can open up the PR unless you've already got one / wanted to handle it.

Thanks for pointing out a fix, very helpful 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants