Код: Выделить всё
import { encode } from 'html-entities';
const xssProtect = (req, res, next) => {
for (const key in req.query) {
if (typeof req.query[key] === 'string') {
const encoded = encode(req.query[key]);
console.log(encoded);
req.query[key] = encoded;
}
}
console.log(req.query);
next();
}
export default xssProtect;
Код: Выделить всё
{
p: 'abcé'
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... q-querykey
Мобильная версия