diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2019-08-18 11:23:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-18 11:23:33 +0200 |
commit | 2edabf3b76473af8d82b4a746ae8f3f6fe31dca8 (patch) | |
tree | d029744a9046e707b26b881e7cae3c98014058bc /allocation_test.go | |
parent | Correctly handle `NoDefaultContentType` without setting an `Content-Type` val... (diff) | |
download | fasthttp-2edabf3b76473af8d82b4a746ae8f3f6fe31dca8.tar.gz fasthttp-2edabf3b76473af8d82b4a746ae8f3f6fe31dca8.tar.bz2 fasthttp-2edabf3b76473af8d82b4a746ae8f3f6fe31dca8.zip |
Add support for user:pass in URLs (#614)
Fixes #609
Diffstat (limited to 'allocation_test.go')
-rw-r--r-- | allocation_test.go | 16 |
1 files changed, 15 insertions, 1 deletions
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) + } +} |