veliovgroup/spiderable-middleware

Possible incorrect regex for header test

arabidopsis opened this issue · 3 comments

The line:

https://github.com/VeliovGroup/spiderable-middleware/blob/05078ab58400307f2acdbfeec3f56f651e5e76ac/lib/index.js#L102

should probably be:

this.headersRE = new RegExp('^' + this.ignoredHeaders.join(strs.pipe) + '$', 'i');

otherwise you will match 'user-agent' for example since it has 'age' in it.

@arabidopsis then it also should be wrapped with parentheses like

new RegExp('^(' + this.ignoredHeaders.join(strs.pipe) + ')$', 'i');

Or I'd prefer ES6:

new RegExp(`^(${this.ignoredHeaders.join(strs.pipe))$`, 'i');

Hello @arabidopsis ,

Thank you a lot for reporting this one, please update to v1.6.2

Feel free to close it in case if the issue is solved on your end.

Closed due to silence at issue owner end.
Feel free to reopen it in case if the issue still persists on your end.