No9 / harmon

middleware for node-http-proxy to modify the remote website response with trumpet
Other
424 stars 62 forks source link

js/css filter with query params #43

Open kingonly opened 7 years ago

kingonly commented 7 years ago

This code: if ((lowercaseUrl.indexOf('.js', req.url.length - 3) !== -1) || (lowercaseUrl.indexOf('.css', req.url.length - 4) !== -1)) { won't work if there are query params after the js/css path. Am I missing something?

No9 commented 7 years ago

Yes - that looks like it doesn't manage querystrings at all. Maybe it's time to parse lowercaseUrl with require('querystring') happy to take a PR with tests for your scenario if you are up for it?

kingonly commented 6 years ago

Sure. Maybe something like req.url.match(/.(js|css)([^\w]|$)/) would be better.