Skip to content

Commit 3c06d9c

Browse files
committed
test new migrations
1 parent 5a866b0 commit 3c06d9c

File tree

14 files changed

+28
-40
lines changed

14 files changed

+28
-40
lines changed

clean-code/app/server/handlers/books.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ func sendError(c fiber.Ctx, code int, message string) error {
4848
Error: message,
4949
})
5050
}
51+
52+
// fiber:context-methods migrated

entgo-sveltekit/handler/todo.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,5 @@ func (th *TodoHandler) DeleteTodoByID(c fiber.Ctx) error {
115115

116116
return c.Status(fiber.StatusOK).JSON(fiber.Map{"message": "Todo item deleted"})
117117
}
118+
119+
// fiber:context-methods migrated

geoip/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func main() {
2727
app.Get("/", handlers.Render())
2828

2929
// Serve static assets
30-
app.Get("/*", static.New("./public", fiber.static.Config{
30+
app.Get("/*", static.New("./public", static.Config{
3131
Compress: true,
3232
}))
3333

minio/multiple/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,5 @@ func isAlphaNumericOrSpecial(char rune) bool {
263263
return false
264264
}
265265
}
266+
267+
// fiber:context-methods migrated

minio/single/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,5 @@ func isAlphaNumericOrSpecial(char rune) bool {
230230
return false
231231
}
232232
}
233+
234+
// fiber:context-methods migrated

mongodb/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,5 @@ func main() {
220220

221221
log.Fatal(app.Listen(":3000"))
222222
}
223+
224+
// fiber:context-methods migrated

oauth2-google/handler/handler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ func Callback(c fiber.Ctx) error {
2222
email := auth.GetEmail(token.AccessToken)
2323
return c.Status(200).JSON(fiber.Map{"email": email, "login": true})
2424
}
25+
26+
// fiber:context-methods migrated

oauth2/handlers/handlers.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ func HTMLPages(c fiber.Ctx) error {
2323
case "/welcome.html":
2424
sessData, err := models.MySessionStore.Get(c)
2525
if err != nil {
26-
return func() {
27-
__fiberRedirectTarget := "/errpage.html"
28-
__fiberRedirectStatus := fiber.StatusInternalServerError
29-
return c.Redirect().Status(__fiberRedirectStatus).To(__fiberRedirectTarget)
30-
}()
26+
return c.Redirect().Status(fiber.StatusInternalServerError).To("/errpage.html")
3127
}
3228

3329
return c.Render("welcome", fiber.Map{

oauth2/middleware/auth.go

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,14 @@ func OAUTHRedirect(ctx fiber.Ctx) error {
6262
}
6363
models.SYSLOG.Tracef("redirecting to /welcome.html?access_token=%v", t.AccessToken)
6464
// return ctx.Redirect("/welcome.html?access_token="+t.AccessToken, fiber.StatusFound)
65-
return func() {
66-
__fiberRedirectTarget := "/welcome.html"
67-
__fiberRedirectStatus := fiber.StatusFound
68-
return ctx.Redirect().Status(__fiberRedirectStatus).To(__fiberRedirectTarget)
69-
}()
65+
return ctx.Redirect().Status(fiber.StatusFound).To("/welcome.html")
7066
}
7167

7268
models.SYSLOG.Tracef("redirecting to /")
73-
return func() {
74-
__fiberRedirectTarget := "/"
75-
__fiberRedirectStatus := fiber.StatusTemporaryRedirect
76-
return ctx.Redirect().Status(__fiberRedirectStatus).To(__fiberRedirectTarget)
77-
78-
// OAUTHProtected processes access attempts; if the session stored token is NULL then it sends to start page
79-
}()
69+
return ctx.Redirect().Status(fiber.StatusTemporaryRedirect).To("/")
8070
}
8171

72+
// OAUTHProtected processes access attempts; if the session stored token is NULL then it sends to start page
8273
func OAUTHProtected(c fiber.Ctx) error {
8374
models.SYSLOG.Tracef("entering OAUTHProtected; original URL: %v", c.OriginalURL())
8475
defer models.SYSLOG.Trace("exiting OAUTHProtected")
@@ -106,11 +97,7 @@ func OAUTHProtected(c fiber.Ctx) error {
10697
if tk == nil {
10798
sessData.Destroy()
10899
models.SYSLOG.Tracef("token is NULL")
109-
return func() {
110-
__fiberRedirectTarget := "/index.html"
111-
__fiberRedirectStatus := fiber.StatusTemporaryRedirect
112-
return c.Redirect().Status(__fiberRedirectStatus).To(__fiberRedirectTarget)
113-
}()
100+
return c.Redirect().Status(fiber.StatusTemporaryRedirect).To("/index.html")
114101
}
115102

116103
return c.Next()
@@ -149,9 +136,5 @@ func OAUTHDisconnect(c fiber.Ctx) error {
149136

150137
sessData.Destroy()
151138

152-
return func() {
153-
__fiberRedirectTarget := "/index.html"
154-
__fiberRedirectStatus := fiber.StatusTemporaryRedirect
155-
return c.Redirect().Status(__fiberRedirectStatus).To(__fiberRedirectTarget)
156-
}()
139+
return c.Redirect().Status(fiber.StatusTemporaryRedirect).To("/index.html")
157140
}

oauth2/router/router.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,10 @@ func SetupRoutes(app *fiber.App) {
2828

2929
// add a standard redirect to the index page
3030
app.Get("/", func(c fiber.Ctx) error {
31-
return func() {
32-
__fiberRedirectTarget := "/index.html"
33-
__fiberRedirectStatus := fiber.StatusTemporaryRedirect
34-
return c.Redirect().Status(__fiberRedirectStatus).To(__fiberRedirectTarget)
35-
36-
// return pages from their templates
37-
}()
31+
return c.Redirect().Status(fiber.StatusTemporaryRedirect).To("/index.html")
3832
})
3933

34+
// return pages from their templates
4035
app.Get("/:template", handlers.HTMLPages)
4136

4237
// perform logout - in fact only the local session is destroyed

0 commit comments

Comments
 (0)