Skip to content

Allow providing a custom request factory#73

Closed
andig wants to merge 1 commit intoshurcooL:mainfrom
andig:patch-1
Closed

Allow providing a custom request factory#73
andig wants to merge 1 commit intoshurcooL:mainfrom
andig:patch-1

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

@andig andig closed this by deleting the head repository Jan 20, 2025
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.

2 participants