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

Allow providing a custom request factory #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andig
Copy link

@andig andig commented Jul 25, 2021

This PR allows customizing the requests sent for APIs that require additional headers.

Replace #47, #48, #49, #64, #68.

This is not the most beautiful solution but offers the highest amount of customizing the request with the least amount of added lines of code. Making the request factory a private member and optional NewClient parameter would be a further option.

/cc @dmitshur

@fi0
Copy link

fi0 commented Jul 29, 2021

how do I provide my own request factory?

@andig
Copy link
Author

andig commented Jul 29, 2021

I've kept it simple. After creating the client you would simply replace client.RequestFactory with a custom func(method, url string, body io.Reader) (*http.Request, error).

@andig
Copy link
Author

andig commented Feb 3, 2023

Ping @dmitshur

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

Successfully merging this pull request may close these issues.

None yet

2 participants