mirror of
https://github.com/kataras/iris.git
synced 2026-01-07 20:17:05 +00:00
fix 2 minor issues
This commit is contained in:
@@ -40,10 +40,7 @@ func newApp(db *DB) *iris.Application {
|
||||
//
|
||||
// Look ./templates/index.html#L16
|
||||
tmpl.AddFunc("IsPositive", func(n int) bool {
|
||||
if n > 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return n > 0
|
||||
})
|
||||
|
||||
app.RegisterView(tmpl)
|
||||
@@ -72,7 +69,7 @@ func newApp(db *DB) *iris.Application {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Redirect(value, iris.StatusTemporaryRedirect)
|
||||
ctx.Redirect(value, iris.StatusBadGateway)
|
||||
}
|
||||
app.Get("/u/{shortkey}", func(ctx iris.Context) {
|
||||
execShortURL(ctx, ctx.Params().Get("shortkey"))
|
||||
|
||||
@@ -37,7 +37,7 @@ func TestURLShortener(t *testing.T) {
|
||||
|
||||
// get
|
||||
e.GET("/u/" + keys[0]).Expect().
|
||||
Status(httptest.StatusTemporaryRedirect).Header("Location").Equal(originalURL)
|
||||
Status(httptest.StatusBadGateway).Header("Location").Equal(originalURL)
|
||||
|
||||
// save the same again, it should add a new key
|
||||
e.POST("/shorten").
|
||||
|
||||
Reference in New Issue
Block a user