xssClean function

Callback xssClean()

Middleware to handle xss filtering.

Implementation

Callback xssClean() {
  return (Req req, Res res) {
    var body = req.body;

    if (body is String) {
      req.body = sanitizeHtml(body);
    }

    if (body is Map || body is List) {
      req.body = jsonDecode(sanitizeHtml(jsonEncode(body)));
    }
  };
}