In my Angular application, I use the nodejs function request.write(req.body); to write requests. Actually, this functionality and requests are working as intended, however there is a "Cross-Site Scripting" (XSS) vulnerability. I looked for alternatives to this issue and tried using'request.send(req.body);' but this time the vulnerability was gone but the original functionality was broken. So, is there a method to replace "request.write(re.body)" to eliminate this vulnerability?
if (req.method === "POST" || req.method === "PUT") {
request.write(req.body);
}