Skip to content

Commit

Permalink
fix: match pipe characters in parameters (Firefox)
Browse files Browse the repository at this point in the history
  • Loading branch information
troch committed Apr 9, 2018
1 parent c4b4c4d commit d6e6d27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/rules.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const defaultOrConstrained = (match: string): string =>
'(' + (match ? match.replace(/(^<|>$)/g, '') : "[a-zA-Z0-9-_.~%':]+") + ')'
'(' + (match ? match.replace(/(^<|>$)/g, '') : "[a-zA-Z0-9-_.~%':|]+") + ')'

export type RegExpFactory = (match: any) => RegExp

Expand Down
8 changes: 8 additions & 0 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,12 @@ describe('Path', function() {
path.test('/Test').should.eql({})
should.not.exist(path.test('/TEST', { caseSensitive: true }))
})

it('should match unencoded pipes (Firefox)', () => {
const path = new Path('/test/:param')

path.test('/test/1|2').should.eql({
param: '1|2'
})
})
})

0 comments on commit d6e6d27

Please sign in to comment.