Skip to content

the router rule is wrong ? #869

@ljyf5593

Description

@ljyf5593

code

package main

import (
	"github.com/labstack/echo"
	"net/http"
)

func main() {
	app := echo.New()

	app.GET("/social/jssdk", func(c echo.Context) error {
		return c.String(http.StatusOK, "jssdk")
	})

	app.GET("/social/upload", func(c echo.Context) error {
		return c.String(http.StatusOK, "upload")
	})

	app.GET("*", func(c echo.Context) error {
		return c.String(http.StatusOK, "any")
	})

	app.Start(":8082")
}

Expected behaviour

request http://localhost:8082/social/user return 404

Actual behaviour

request http://localhost:8082/social/user return "any"

Steps to reproduce

request any other url like http://localhost:8082/social/uXXXX will be return 404
request any other url like http://localhost:8082/social/XXXX not "u" will be return "any"

Version/commit

go env
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=E:\go
set GORACE=
set GOROOT=D:\Go
set GOTOOLDIR=D:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions