소스 검색

Allow username:password to be included with host

allow_https
Paul Bonser 7 년 전
부모
커밋
d7fb602e0f
2개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. +1
    -1
      goes.go
  2. +5
    -0
      goes_test.go

+ 1
- 1
goes.go 파일 보기

@@ -582,7 +582,7 @@ func (c *Client) AliasExists(alias string) (bool, error) {
} }


func (c *Client) replaceHost(req *http.Request) { func (c *Client) replaceHost(req *http.Request) {
req.URL.User = c.Host.User
req.URL.Scheme = c.Host.Scheme req.URL.Scheme = c.Host.Scheme
req.URL.Host = c.Host.Host req.URL.Host = c.Host.Host
} }


+ 5
- 0
goes_test.go 파일 보기

@@ -44,6 +44,11 @@ func (s *GoesTestSuite) TestNewClient(c *C) {
c.Assert(conn, DeepEquals, &Client{&url.URL{Scheme: "http", Host: ESHost + ":" + ESPort}, http.DefaultClient, ""}) c.Assert(conn, DeepEquals, &Client{&url.URL{Scheme: "http", Host: ESHost + ":" + ESPort}, http.DefaultClient, ""})
} }


func (s *GoesTestSuite) TestNewClientWithAuth(c *C) {
conn := NewClient("foo:bar@"+ESHost, ESPort)
c.Assert(conn, DeepEquals, &Client{&url.URL{Scheme: "http", User: url.UserPassword("foo", "bar"), Host: ESHost + ":" + ESPort}, http.DefaultClient, ""})
}

func (s *GoesTestSuite) TestWithHTTPClient(c *C) { func (s *GoesTestSuite) TestWithHTTPClient(c *C) {
tr := &http.Transport{ tr := &http.Transport{
DisableCompression: true, DisableCompression: true,


불러오는 중...
취소
저장