aboutsummaryrefslogtreecommitdiff
path: root/uri_test.go
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-12-22 20:13:45 +0200
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-12-22 20:13:45 +0200
commitb3c0a2cf75c7e1e16c97f500a56b5621f0238607 (patch)
treef7319d4ef5c1dbaf95e28d3aec419943918b89c8 /uri_test.go
parentImport fasthttp in server examples (diff)
downloadfasthttp-b3c0a2cf75c7e1e16c97f500a56b5621f0238607.tar.gz
fasthttp-b3c0a2cf75c7e1e16c97f500a56b5621f0238607.tar.bz2
fasthttp-b3c0a2cf75c7e1e16c97f500a56b5621f0238607.zip
Do not escape the most frequently used chars in uri path such as ':~=,'
Diffstat (limited to 'uri_test.go')
-rw-r--r--uri_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/uri_test.go b/uri_test.go
index 637f00e..13ef871 100644
--- a/uri_test.go
+++ b/uri_test.go
@@ -5,6 +5,21 @@ import (
"testing"
)
+func TestURIPathEscape(t *testing.T) {
+ testURIPathEscape(t, "/foo/bar", "/foo/bar")
+ testURIPathEscape(t, "/foo=b:ar,b.c&q", "/foo=b:ar,b.c&q")
+ testURIPathEscape(t, "/aa?bb.тест~qq", "/aa%3Fbb.%D1%82%D0%B5%D1%81%D1%82~qq")
+}
+
+func testURIPathEscape(t *testing.T, path, expectedRequestURI string) {
+ var u URI
+ u.SetPath(path)
+ requestURI := u.RequestURI()
+ if string(requestURI) != expectedRequestURI {
+ t.Fatalf("unexpected requestURI %q. Expecting %q. path %q", requestURI, expectedRequestURI, path)
+ }
+}
+
func TestURIUpdate(t *testing.T) {
// full uri
testURIUpdate(t, "http://foo.bar/baz?aaa=22#aaa", "https://aa.com/bb", "https://aa.com/bb")