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: RoundTripper behavour change #10918

Closed
kylewolfe opened this issue May 20, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@kylewolfe
Copy link

commented May 20, 2015

Change in question: e1d9fcd#diff-91f5f51987ce03a73a7d2e8b701f84e9R142

I realize that the functionality of RoundTripper was poorly defined. I tried asking several times on the gonuts forum as well as stackoverflow as to its intention, and how it should be used. With this change however, it now breaks some functionality I had in a previous version of Go.

I unfortunately have to deal with SOAP APIs quite frequently. So I use a custom RoundTripper that parses the response body for the fault and returns a new error type specific to a soap fault. While I know this goes against what was then slightly documented (http://golang.org/pkg/net/http/#RoundTripper), I'm note sure I'm sold that this restriction of resp == nil when error != should be enforced, as it was not before.

@bradfitz

This comment has been minimized.

Copy link
Member

commented May 20, 2015

You don't clarify which versions of Go.

Specify which version of Go you used before and in which version the behavior changed.

But I suspect you're talking about things <= Go 1.4, in which case the ship has sailed.

I'm also not just what SOAP has to do with this bug.

@bradfitz

This comment has been minimized.

Copy link
Member

commented May 20, 2015

Yeah, that CL was almost 3 years ago and just clarified the status quo. I don't believe there's anything to do here.

@bradfitz bradfitz closed this May 20, 2015

@kylewolfe

This comment has been minimized.

Copy link
Author

commented May 20, 2015

A custom SOAP RoundTripper is just my use case in which I think a response should be returnable along with an error.

Sorry for not supplying versions. I do believe you are correct. I am running go 1.4.2 and was using 1.3.x when the functionality was working.

@mikioh mikioh changed the title RoundTripper behavour change net/http: RoundTripper behavour change May 21, 2015

@rogpeppe

This comment has been minimized.

Copy link
Contributor

commented May 21, 2015

I would suggest that RoundTripper is too low a level for SOAP functionality.

@kylewolfe

This comment has been minimized.

Copy link
Author

commented May 21, 2015

Ideally I would like to create a wrapper to http.Client. However there is not a Client interface in the standard library. Due to this, APIs have to request a pointer to an http.Client struct, which makes it impossible to wrap a http.Client and satisfy that dependency in third party APIs.

Are there an discussions around this, perhaps? I'd like to try to get this in to discussions for Go 2 if possible.

@golang golang locked and limited conversation to collaborators Jun 25, 2016

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