diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-02-14 23:46:09 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2018-02-14 23:46:09 +0100 |
commit | 4cc9a5e73e5731d1033a0d1ec7e424bfa780b25d (patch) | |
tree | 6a0b0cfe106328b3431cdbbe0c694328df482601 /plumbing/transport/http/upload_pack_test.go | |
parent | 5d5b95168c9ed9f3210ddca5ce220fe3dbbebc0c (diff) | |
download | go-git-4cc9a5e73e5731d1033a0d1ec7e424bfa780b25d.tar.gz |
transport: http, fix services redirecting only info/refs
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
Diffstat (limited to 'plumbing/transport/http/upload_pack_test.go')
-rw-r--r-- | plumbing/transport/http/upload_pack_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/plumbing/transport/http/upload_pack_test.go b/plumbing/transport/http/upload_pack_test.go index fbd28c7..3b85af5 100644 --- a/plumbing/transport/http/upload_pack_test.go +++ b/plumbing/transport/http/upload_pack_test.go @@ -75,3 +75,31 @@ func (s *UploadPackSuite) newEndpoint(c *C, name string) *transport.Endpoint { return ep } + +func (s *UploadPackSuite) TestAdvertisedReferencesRedirectPath(c *C) { + endpoint, _ := transport.NewEndpoint("https://gitlab.com/gitlab-org/gitter/webapp") + + session, err := s.Client.NewUploadPackSession(endpoint, s.EmptyAuth) + c.Assert(err, IsNil) + + info, err := session.AdvertisedReferences() + c.Assert(err, IsNil) + c.Assert(info, NotNil) + + url := session.(*upSession).endpoint.String() + c.Assert(url, Equals, "https://gitlab.com/gitlab-org/gitter/webapp.git") +} + +func (s *UploadPackSuite) TestAdvertisedReferencesRedirectSchema(c *C) { + endpoint, _ := transport.NewEndpoint("http://github.com/git-fixtures/basic") + + session, err := s.Client.NewUploadPackSession(endpoint, s.EmptyAuth) + c.Assert(err, IsNil) + + info, err := session.AdvertisedReferences() + c.Assert(err, IsNil) + c.Assert(info, NotNil) + + url := session.(*upSession).endpoint.String() + c.Assert(url, Equals, "https://github.com/git-fixtures/basic") +} |