Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add querrystring parser #284

Merged
merged 1 commit into from
May 18, 2022
Merged

Add querrystring parser #284

merged 1 commit into from
May 18, 2022

Conversation

ivan-tymoshenko
Copy link
Collaborator

@ivan-tymoshenko ivan-tymoshenko commented May 15, 2022

We are already searching the querystring in the path and are spending some time on it. I want to pass the querystring to the handler instead of parsing it again in the handler. The querystring would be passed to the handler as a new argument.

+ find-my-way handle ';' as a querystring start symbol and fastify doesn't.

The changes to the fastify:
ivan-tymoshenko/fastify@00087f0

Benchmarks:
In the main branch, I added a handler that parses querystring in the same way as fastify does
(https://github.com/fastify/fastify/blob/0a4649f504bd466ce7dd37b510832746b213b2d4/lib/route.js#L377) and compared it with parsing a querystring natively in the find-my-way.

Handler in the main branch:

  findMyWay.on(method, url, (req) => {
    const queryPrefix = req.url.indexOf('?')
    const query = querystring.parse(queryPrefix > -1 ? req.url.slice(queryPrefix + 1) : '')
    return query
  })

Снимок экрана 2022-05-15 в 18 23 22

Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you update the docs?

Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina
Copy link
Collaborator

Can you fix the conflicts?

@mcollina
Copy link
Collaborator

mcollina commented May 18, 2022

Can you fix the conflicts (sorry)?

@mcollina mcollina merged commit 349f8e4 into main May 18, 2022
@ivan-tymoshenko ivan-tymoshenko deleted the add-querytring-parser branch May 18, 2022 10:56
@Uzlopak
Copy link
Contributor

Uzlopak commented May 23, 2022

Wow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants