mercredi 3 juillet 2019

How to set properties on the request object in chai?

I am testing my app with mocha + chai. Is there a way I can add custom properties to my GET, POST or PUT chai requests?

For example I want something like:

chai.request(app) .get(/api/orders/a57/return_items) .set_Property_on_req_Object("user_id","value") .end((err, res) => { res.should.have.status(200); res.body.should.be.a('object'); done(); });

And, at the server side, I'm reading the property user_id as const userId = req.user_id;

Aucun commentaire:

Enregistrer un commentaire