1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 12:31:58 +00:00

add vscode extension link and badge | Some internal improvements (not completed yet)

Former-commit-id: 9bc94e90a2780ee81f8188509d98063fb3f2924b
This commit is contained in:
Gerasimos (Makis) Maropoulos
2018-01-25 03:16:49 +02:00
parent 243439af9d
commit bf13f7648a
16 changed files with 293 additions and 219 deletions

View File

@@ -9,7 +9,7 @@ import (
func TestCasbinWrapper(t *testing.T) {
app := newApp()
e := httptest.New(t, app, httptest.Debug(true))
e := httptest.New(t, app)
type ttcasbin struct {
username string
@@ -43,7 +43,6 @@ func TestCasbinWrapper(t *testing.T) {
check(e, tt.method, tt.path, tt.username, tt.status)
}
println("ADMIN ROLES")
ttAdmin := []ttcasbin{
{"cathrin", "/dataset1/item", "GET", 200},
{"cathrin", "/dataset1/item", "POST", 200},
@@ -57,7 +56,6 @@ func TestCasbinWrapper(t *testing.T) {
check(e, tt.method, tt.path, tt.username, tt.status)
}
println("ADMIN ROLE FOR cathrin DELETED")
Enforcer.DeleteRolesForUser("cathrin")
ttAdminDeleted := []ttcasbin{

View File

@@ -42,7 +42,7 @@ func getSignupForm(ctx iris.Context) {
// views/signup.html just needs a {{ .csrfField }} template tag for
// csrf.TemplateField to inject the CSRF token into. Easy!
ctx.ViewData(csrf.TemplateTag, csrf.TemplateField(ctx))
ctx.View("views/user/signup.html")
ctx.View("user/signup.html")
// We could also retrieve the token directly from csrf.Token(r) and
// set it in the request header - ctx.GetHeader("X-CSRF-Token", token)

View File

@@ -24,10 +24,7 @@ func TestSubdomainRedirectWWW(t *testing.T) {
}
for _, test := range tests {
req := e.GET(test.path)
// req.WithURL("http://www." + root)
req.Expect().Status(httptest.StatusOK).Body().Equal(test.response)
e.GET(test.path).Expect().Status(httptest.StatusOK).Body().Equal(test.response)
}
}

View File

@@ -30,19 +30,19 @@ func newApp() *iris.Application {
www := app.Party("www.")
{
// Just to show how you can get all routes and copy them to another
// party or subdomain:
// Get all routes that are registered so far, including all "Parties" and subdomains:
currentRoutes := app.GetRoutes()
// Register them to the www subdomain/vhost as well:
for _, r := range currentRoutes {
www.Handle(r.Method, r.Tmpl().Src, r.Handlers...)
}
// http://www.mydomain.com/hi
www.Get("/hi", func(ctx iris.Context) {
ctx.Writef("hi from www.mydomain.com")
})
// Just to show how you can get all routes and copy them to another
// party or subdomain:
// Get all routes that are registered so far, including all "Parties" but subdomains:
currentRoutes := app.GetRoutes()
// Register them to the www subdomain/vhost as well:
for _, r := range currentRoutes {
www.Handle(r.Method, r.Path, r.Handlers...)
}
}
// See also the "subdomains/redirect" to register redirect router wrappers between subdomains,
// i.e mydomain.com to www.mydomain.com (like facebook does for SEO reasons(;)).

View File

@@ -41,13 +41,13 @@ func TestSubdomainWWW(t *testing.T) {
}
host := "localhost:1111"
e := httptest.New(t, app, httptest.URL("http://"+host))
e := httptest.New(t, app, httptest.URL("http://"+host), httptest.Debug(false))
for _, test := range tests {
req := e.Request(test.method, test.path)
if subdomain := test.subdomain; subdomain != "" {
req.WithURL("http://" + subdomain + "." + host)
req = req.WithURL("http://" + subdomain + "." + host)
}
req.Expect().