1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 03:17:04 +00:00
This commit is contained in:
Gerasimos Maropoulos
2016-07-21 20:33:00 +03:00
parent 6b71452222
commit 85a2e98ba4
3 changed files with 52 additions and 21 deletions

View File

@@ -10,7 +10,6 @@ import (
"fmt"
"io/ioutil"
"os"
"strconv"
"testing"
"time"
@@ -243,12 +242,13 @@ func TestMultiRunningServers_v2(t *testing.T) {
}
const (
testEnableSubdomain = false
testSubdomain = "mysubdomain.com"
testEnableSubdomain = true
testSubdomain = "mysubdomain"
)
func testSubdomainHost() string {
return testSubdomain + strconv.Itoa(Servers.Main().Port())
s := testSubdomain + "." + Servers.Main().Host()
return s
}
func testSubdomainURL() (subdomainURL string) {
@@ -433,6 +433,20 @@ func TestMuxPathEscape(t *testing.T) {
Expect().Status(StatusOK).Body().Equal("name=Sakamoto desu ga,highlight=text")
}
func TestMuxEncodeURL(t *testing.T) {
initDefault()
Get("/encoding/:url", func(ctx *Context) {
url := URLEncode(ctx.Param("url"))
ctx.SetStatusCode(StatusOK)
ctx.Write(url)
})
e := Tester(t)
e.GET("/encoding/http%3A%2F%2Fsome-url.com").Expect().Status(StatusOK).Body().Equal("http://some-url.com")
}
func TestMuxCustomErrors(t *testing.T) {
var (
notFoundMessage = "Iris custom message for 404 not found"