Closed jnelle closed 2 years ago
If the http client follows the redirect, it will see mfp://identify/....
which is invalid to the http client. I think you want to configure CheckRedirect
of the http client to prevent it from following the redirect and handle the header yourself. See https://pkg.go.dev/net/http@go1.19.1#Client for documentation about CheckRedirect
.
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
For questions please refer to https://github.com/golang/go/wiki/Questions
Why isn't this a bug? @seankhliao
The client followed the redirect (default policy) and you haven't registered a RoundTripper for the given scheme, so it's an outgoing request error.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I wrote a http wrapper for the MyFitnessPal API. When I'm trying to get a callback code which is located in the header, I'll get an error message. To reproduce clone the following repository and install the dependencies and then run:
What did you expect to see?
A response with status code 302 and a location header which contains the callback code.
What did you see instead?
I'll get the following error message:
response variable is nil.
I know that this "mfp://" url is in headers, because I checked it with a proxy before (see screenshot below)
It looks like net/http is validating header values, which, if I understood it right, should'nt do it