Closed libook closed 7 years ago
@libook
This works: this.assert(param, 400, JSON.stringify({ msg: "It died" }))
what is the purpose of this? you can just have your error handle json stringify the error however you'd like
Well, http-assert just respond to client when there was an 'false'. And it only respond the error message in body. What if the client needs more information form body. I think responding a JSON could be a perfect way.
I'm sorry, I don't understand what the ask even is here, after reading this. All this module does is throw an Error
object; it doesn't do any serialization. Perhaps a PR may help communicate the idea across in code form.
I can use http-assert in this way:
But in many times, I want to response a json like this:
This does not work probably. So will you support this method?