Discussions

Ask a Question
Back to All

Empty request body in tests

I have a POST request that contains some data I need to inspect before deciding which deadbolt dynamic constraint to use, so I'm parsing the request body using Play's action builder Action.async(parse.json) and then calling one of two dynamic handlers based on the content.

Invoking the endpoint with curl works as expected, however in my integration tests the deadbolt actions fail with a 'Invalid Json: No content to map due to end-of-input' error. I've got a feeling that this is due to the controller stubbing in Play tests but is there anything in deadbolt that could effect the tests in this way?