aboutsummaryrefslogtreecommitdiff
path: root/uri_test.go
diff options
context:
space:
mode:
authorGravatar Sergey Ponomarev <stokito@gmail.com> 2021-11-08 14:35:26 +0200
committerGravatar GitHub <noreply@github.com> 2021-11-08 13:35:26 +0100
commit3ff6aaa5917f40eeb5cdcb4272c58210f161f0ea (patch)
tree53ec8a4c5463d22aae967de353bc12e995da0152 /uri_test.go
parenthttp.go: Request.SetURI() (Fix #1141) (#1148) (diff)
downloadfasthttp-3ff6aaa5917f40eeb5cdcb4272c58210f161f0ea.tar.gz
fasthttp-3ff6aaa5917f40eeb5cdcb4272c58210f161f0ea.tar.bz2
fasthttp-3ff6aaa5917f40eeb5cdcb4272c58210f161f0ea.zip
uri: isHttps() and isHttp() (#1150)
* uri: isHttps() and isHttp() Use them instead of manual schema comparison * uri: use SetSchemeBytes()
Diffstat (limited to 'uri_test.go')
-rw-r--r--uri_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/uri_test.go b/uri_test.go
index fc0b2ef..a605b46 100644
--- a/uri_test.go
+++ b/uri_test.go
@@ -310,6 +310,29 @@ func testURIParseScheme(t *testing.T, uri, expectedScheme, expectedHost, expecte
}
}
+func TestIsHttp(t *testing.T) {
+ var u URI
+ if !u.isHttp() || u.isHttps() {
+ t.Fatalf("http scheme is assumed by default and not https")
+ }
+ u.SetSchemeBytes([]byte{})
+ if !u.isHttp() || u.isHttps() {
+ t.Fatalf("empty scheme must be threaten as http and not https")
+ }
+ u.SetScheme("http")
+ if !u.isHttp() || u.isHttps() {
+ t.Fatalf("scheme must be threaten as http and not https")
+ }
+ u.SetScheme("https")
+ if !u.isHttps() || u.isHttp() {
+ t.Fatalf("scheme must be threaten as https and not http")
+ }
+ u.SetScheme("dav")
+ if u.isHttps() || u.isHttp() {
+ t.Fatalf("scheme must be threaten as not http and not https")
+ }
+}
+
func TestURIParse(t *testing.T) {
t.Parallel()