dareid / chakram

REST API test framework. BDD and exploits promises
http://dareid.github.io/chakram/
MIT License
908 stars 99 forks source link

Handle Request & Response #68

Open fescobar opened 8 years ago

fescobar commented 8 years ago

I would like to know if it's possible handle requests & responses? For me it's necessary for logging, add headers by default or for logging responses (attributes as url, headers, body, statusCode), etc when the tests failed. It's that possible?

dareid commented 8 years ago

Hi,

Not sure if I get your whole question, but feel free to clarify if I do not answer your question fully.

In terms of logging, we have a debug option, which can be seen here http://dareid.github.io/chakram/jsdoc/module-chakram.html#.startDebug. This should wrap the requests to log the response.

Headers (and other request defaults) can be set on all requests using http://dareid.github.io/chakram/jsdoc/module-chakram.html#.setRequestDefaults.

fescobar commented 8 years ago

That's usefull, but I would like that the response data could be logged just when the test is failed. I need reduce disk consumption.

dareid commented 8 years ago

This is not possible at the moment, debug is either on or off for a request. Feel free to raise a PR for this functionality