visionmedia / page.js

Micro client-side router inspired by the Express router
http://visionmedia.github.com/page.js
7.67k stars 687 forks source link

bug for omitting query and hash from pathname #575

Open shokai opened 3 years ago

shokai commented 3 years ago

Hi, I found a bug and I'm reporting it.

const page = require('./')

page('/foo', ctx => {
  console.log('canonicalPath', ctx.canonicalPath)
  console.log('pathname', ctx.pathname)
})

page('/foo?hello=there')
page('/foo#hash')
page('/foo?hello=there#hash') // query and hash

output

canonicalPath /foo?hello=there
pathname /foo
canonicalPath /foo#hash
pathname /foo
canonicalPath /foo?hello=there#hash
pathname /foo?hello=there