Skip to content

Make it safe for users to wrap transport with their own middleware - #79

Merged
jhump merged 1 commit into
mainfrom
jh/make-it-middleware-safe
Apr 28, 2025
Merged

jhump merged 1 commit into
mainfrom
jh/make-it-middleware-safe

Conversation

@jhump

@jhump jhump commented Apr 28, 2025

Copy link
Copy Markdown
Member

I also considered adding an option, like WithMiddleware(func(http.RoundTripper) http.RoundTripper) ClientOption. I can change to that if it seems better. But the approach in this PR makes the wrapping more of a caller concern, which could make it more flexible, and also means no extra exported API.

Resolves #78.

@jhump jhump assigned ghost Apr 28, 2025
@jhump jhump mentioned this pull request Apr 28, 2025
@jhump
jhump force-pushed the jh/make-it-middleware-safe branch from 19720c7 to 7b8b039 Compare April 28, 2025 14:16

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern is that it's awkward if the user does something like set the Transport to a totally different transport that doesn't wrap the original, but I guess there's really no way for us to detect that situation anyways.

@jhump
jhump merged commit 1d8b08b into main Apr 28, 2025
@jhump
jhump deleted the jh/make-it-middleware-safe branch April 28, 2025 17:45
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

Successfully merging this pull request may close these issues.

Wrapping Transport

1 participant