TestFramework throws NullPointerException on empty body
After the last refactoring of TestFramework (http://github.com/dpp/liftweb/commit/fff1da253aeff07c26c705fbc3327e021947edd5) it throws a NullPointerException when an empty body is constructed. The reason for this is that the new implicit creates an HttpResponse using "readWholeStream(getter.getResponseBodyAsStream)" and HttpMethodBase's contract is to return null when the body is not available. As a result IoHelpers.readWholeStream chokes on the null argument.
Previously the new HttpResponse was constructed using "getter.getResponseBody", which worked fine.
Is there a reason the HttpResponse is constructed using a different constructor and if yes, how would one test a response with an empty body?
Previously the new HttpResponse was constructed using "getter.getResponseBody", which worked fine.
Is there a reason the HttpResponse is constructed using a different constructor and if yes, how would one test a response with an empty body?
Leave a comment
Here's the proposed fix:
http://github.com/vdichev/liftweb/commit/0bdd733bd3b5135ba29110d96eb28553c8077bf8
http://github.com/vdichev/liftweb/commit/0bdd733bd3b5135ba29110d96eb28553c8077bf8
(In revision:e7b59e87195a363b5da10fd17a2b54a13038e506) Closes #544. Changed the return signature for the body of the response to Box[Array[Byte]]. It's a breaking change, but more true to the way things should be done.
Branch: master
Branch: master