Skip to content
Myr

fix(linear-router): incorrect path matching (#4567)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* fix(linear-router): prevent false matches between static and parameterized routes * fix(linear-router): incorrect path matching

authored by Christian Ek · committed by GitHub · parent 81666ac · Browse files · 2 files+9 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Taku Amano <taku@taaas.jp>

Diff stats

2 files+9 added−1 removed

  • tests:+5 added−1 removed
  • other:+4 added−0 removed

2 files+9 added−1 removed

modified:src/router/linear-router/router.ts+4 added
modified:src/router/common.case.test.ts+5 added-1 removed
107 unmodified lines
108109 describe('Complex', () => {110 it('Named Param', async () => {111 router.add('GET', '/entry/:id', 'get entry')112 const res = match('GET', '/entry/123')112 let res = match('GET', '/entry/123')113114 expect(res.length).toBe(1)115 expect(res[0].handler).toEqual('get entry')116 expect(res[0].params['id']).toBe('123')117118 res = match('GET', '/entry-123')119 expect(res.length).toBe(0)120 })121122 it('Wildcard', async () => {123 router.add('GET', '/wild/*/card', 'get wildcard')
759 unmodified lines