Does
res.status(200)
res.json({
isSuccess: true
});
equals to
res.status(200).json({
isSuccess: true
});
?
I'll explain why I ask. I build a MEAN app and use mocha for the unit tests.
As I have seen in some tutorial somewhere, I send res as a validation function to check the return values.
Actually res is built out of two functions: status and json. When the BE API changes the status or the json for the response, it actually calls the validation function to check the values.
The reason I ask is that when I do res.status(200).json(...) only the status function is being called. When I use the second method, both function are being called as I intended.
Thanks
via Edgar Barber
No comments:
Post a Comment