You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem. Thanks.
What steps will reproduce the problem?
1. attempt to http.Get on a URI with embedded username/password such as:
http://username:password@api.twitter.com/1/ajstarks/msm/members.json
What is the expected output? What do you see instead?
GET fails with a status code of 401 instead of the expected 200
What is your $GOOS? $GOARCH?
darwin amd64
Which revision are you using? (hg identify)
7929874a70ae+ release
Please provide any additional information below.
(substitute username:password with a valid account)
$ curl http://username:password@api.twitter.com/1/ajstarks/msm/members.json
works,
but
package main
import (
"fmt";
"http";
"io/ioutil";
)
func printContent(s string) {
r, final, err := http.Get(s);
if r.StatusCode == 200 {
var b []byte;
if err == nil {
b, err = ioutil.ReadAll(r.Body);
fmt.Printf(string(b));
r.Body.Close();
}
} else fmt.Printf("final: %v, err: %v (%v)\n", final, err, r.StatusCode);
}
func main() {
printContent("http://username:password@api.twitter.com/1/ajstarks/msm/members.json";);
printContent("http://search.twitter.com/search.json?q=%23golang";);
}
returns:
final: http://username:password@api.twitter.com/1/ajstarks/msm/members.json, err:
<nil> (401)
.....content from second URI....
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: