From 2edabf3b76473af8d82b4a746ae8f3f6fe31dca8 Mon Sep 17 00:00:00 2001 From: Erik Dubbelboer Date: Sun, 18 Aug 2019 11:23:33 +0200 Subject: Add support for user:pass in URLs (#614) Fixes #609 --- allocation_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'allocation_test.go') diff --git a/allocation_test.go b/allocation_test.go index e57c3af..45f10e5 100644 --- a/allocation_test.go +++ b/allocation_test.go @@ -49,7 +49,7 @@ func TestAllocationClient(t *testing.T) { go s.Serve(ln) c := &Client{} - url := "http://" + ln.Addr().String() + url := "http://test:test@" + ln.Addr().String() + "/foo?bar=baz" n := testing.AllocsPerRun(100, func() { req := AcquireRequest() @@ -68,3 +68,17 @@ func TestAllocationClient(t *testing.T) { t.Fatalf("expected 0 allocations, got %f", n) } } + +func TestAllocationURI(t *testing.T) { + uri := []byte("http://username:password@example.com/some/path?foo=bar#test") + + n := testing.AllocsPerRun(100, func() { + u := AcquireURI() + u.Parse(nil, uri) + ReleaseURI(u) + }) + + if n != 0 { + t.Fatalf("expected 0 allocations, got %f", n) + } +} -- cgit v1.2.3