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

net/http/httptest: clarify that Server.Client is only good for Server.URL #30774

Open
bradfitz opened this issue Mar 12, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@bradfitz
Copy link
Member

commented Mar 12, 2019

The docs don't make it clear that the http.Client returned by httptest.Server.Client is only good for hitting httptest.Server.URL.

That is, the http.Client's Transport doesn't redirect all dials of any hostname to the test server. (Maybe it should? Would that break existing users?)

/cc @Capstan

@bradfitz bradfitz added this to the Go1.13 milestone Mar 12, 2019

@Capstan

This comment has been minimized.

Copy link

commented Mar 12, 2019

If a test is testing that a client configures the right host and port, it'd be nice if there were a recipe for how to use httptest.Server with that, ideally without much or heavyweight (e.g., cert generation on the fly) boilerplate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.