diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2015-10-27 19:01:21 +0200 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2015-10-27 19:01:21 +0200 |
commit | 4edb6bacf46606554bda811e61f14635e6ccbb33 (patch) | |
tree | 6ae42d5c1d8f52db00d16e99effecba65cf1f8b9 /uri_test.go | |
parent | Added SetCanonical() methods to RequestHeader and ResponseHeader (diff) | |
download | fasthttp-4edb6bacf46606554bda811e61f14635e6ccbb33.tar.gz fasthttp-4edb6bacf46606554bda811e61f14635e6ccbb33.tar.bz2 fasthttp-4edb6bacf46606554bda811e61f14635e6ccbb33.zip |
Use QueryString contents if QueryArgs is empty in URI.AppendBytes
Diffstat (limited to 'uri_test.go')
-rw-r--r-- | uri_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/uri_test.go b/uri_test.go index 423cfaa..3dc5417 100644 --- a/uri_test.go +++ b/uri_test.go @@ -73,6 +73,15 @@ func TestURIAppendBytes(t *testing.T) { args.Set("foo", "bar") args.Set("xxx", "йух") testURIAppendBytes(t, "", "xxx.com", "/тест123", "2er", &args, "http://xxx.com/%D1%82%D0%B5%D1%81%D1%82123?foo=bar&xxx=%D0%B9%D1%83%D1%85#2er") + + // test with empty args and non-empty query string + var u URI + u.Parse([]byte("google.com"), []byte("/foo?bar=baz&baraz#qqqq")) + buf := u.AppendBytes(nil) + expectedURI := "http://google.com/foo?bar=baz&baraz#qqqq" + if string(buf) != expectedURI { + t.Fatalf("Unexpected URI: %q. Expected %q", buf, expectedURI) + } } func testURIAppendBytes(t *testing.T, scheme, host, path, hash string, args *Args, expectedURI string) { |