Skip to content

Commit 6479741

Browse files
authored
Merge pull request #257 from devfeel/aicode-fix-trailing-slash
fix: return 404 instead of 301 for trailing slash (issue #245)
2 parents 0844515 + af2168e commit 6479741

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

.github/workflows/go.yml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
11
name: Go
22
on: [push]
3-
jobs:
43

4+
jobs:
55
build:
66
name: Build
77
runs-on: ubuntu-latest
88
steps:
9+
- name: Set up Go
10+
uses: actions/setup-go@v4
11+
with:
12+
go-version: '1.21'
913

10-
- name: Set up Go 1.13
11-
uses: actions/setup-go@v1
12-
with:
13-
go-version: 1.13
14-
id: go
15-
16-
- name: Check out code into the Go module directory
17-
uses: actions/checkout@v1
14+
- name: Check out code
15+
uses: actions/checkout@v4
1816

19-
- name: Get dependencies
20-
run: |
21-
go get -v -t -d ./...
22-
if [ -f Gopkg.toml ]; then
23-
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
24-
dep ensure
25-
fi
17+
- name: Build
18+
run: go build -v .
2619

27-
- name: Build
28-
run: go build -v .
20+
- name: Test
21+
run: go test -v ./...

router.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func (ps Params) ByName(name string) string {
156156
// Path auto-correction, including trailing slashes, is enabled by default.
157157
func NewRouter(server *HttpServer) *router {
158158
return &router{
159-
RedirectTrailingSlash: true,
159+
RedirectTrailingSlash: false,
160160
RedirectFixedPath: true,
161161
HandleOPTIONS: true,
162162
allRouterExpress: make(map[string]struct{}),

0 commit comments

Comments
 (0)