mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
14 lines
367 B
JavaScript
14 lines
367 B
JavaScript
// Safe: req.query.lang routed through the project-local `stripCRLF` helper
|
|
// before being written to the response header.
|
|
function stripCRLF(raw) {
|
|
return raw.replace(/[\r\n]/g, '');
|
|
}
|
|
|
|
function handler(req, res) {
|
|
const lang = req.query.lang;
|
|
const safe = stripCRLF(lang);
|
|
res.setHeader('X-Lang', safe);
|
|
res.end();
|
|
}
|
|
|
|
module.exports = handler;
|