0

I have created the middleware, where i am able to modify request.body and request.query as I am getting it as object but I am not able to get path params as object because in sails request.params gives array type with values in URL format instead of object.

Also I am not able to modify the request.param in mddleware.

Soorya Prakash
  • 921
  • 3
  • 9
  • 29
  • I would say the best and easiest option is adding some custom middleware in config/http.js. Sails is built on top of express so you could use express-sanitizer - https://github.com/markau/express-sanitizer to cleanse the data. – Glen Sep 26 '19 at 22:12
  • I have modified my question above. Could you pls share your thoughts. – Soorya Prakash Sep 27 '19 at 11:51
  • As I understand the params are not available at this level. So you will have to sanitize params content at model level. You can the beforeCreate / beforeUpdate lifecycle callbacks for that. – Glen Oct 01 '19 at 23:20

0 Answers0