slanatech / swagger-stats

API Observability. Trace API calls and Monitor API performance, health and usage statistics in Node.js Microservices.
https://swaggerstats.io/
MIT License
891 stars 136 forks source link

Fix question mark character error for path-to-regexp #146

Closed Pierre-HenriLemp closed 2 years ago

Pierre-HenriLemp commented 2 years ago

When a query strings question mark ( ? ) is present in one path, it must be escaped according to the path-to-regexp documentation if it is not used to define an optional parameter.

When using paths that contain query strings, you need to escape the question mark (?) to ensure it does not flag the parameter as optional.

Edit: Update regex with /\?(\w+=)/g instead of /\?/g to insure that the '?' is used for a query string

coveralls commented 2 years ago

Coverage Status

Coverage increased (+0.004%) to 89.395% when pulling 4b2161a4efb061a2c8941274b53465f459d611a7 on Pierre-HenriLemp:fix/question_mark_fix into e6913470a42bfeddb1aa0911d7802de4363bd6b9 on slanatech:master.

Pierre-HenriLemp commented 2 years ago

@sv2 Could you please release a new version with this fix included?

sv2 commented 2 years ago

@sv2 Could you please release a new version with this fix included?

Yes, will do shortly