Open
Description
Current Behavior
When AddTrainlingSlash middleware is used, the swagger route starts an infinite redirection loop resulting in ERR_TOO_MANY_REDIRECTS
on the browser. It happens with both index.html
and doc.json
routes.
Steps to reproduce
- Follow the usage instructions and add the
AddTrailingSlash
middleware to the app:
package main
import (
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
echoSwagger "github.com/swaggo/echo-swagger"
)
// @title Swagger Example API
// @version 1.0
// @description This is a sample server Petstore server.
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email [email protected]
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host petstore.swagger.io
// @BasePath /v2
func main() {
e := echo.New()
e.Pre(middleware.AddTrailingSlash())
e.GET("/swagger/*", echoSwagger.WrapHandler)
e.Logger.Fatal(e.Start(":1323"))
}
Metadata
Assignees
Labels
No labels