1

I'm using ZombieJS v4 (4.0.13), and am trying to access the client's request body, since some tests require me to monitor the fields that are automatically sent via client forms. While I can access all the query-string fields by using the pipeline's addHandler hook, I can't seem to read the request body in order to extract body post params.

Working with the response body is easy - I can access it from the pipeline by waiting for the response to consume. But the request body always appears as null, with _bodyUsed = true, so I can't wait for it in the same manner.

Anyone knows of a way I can access the sent request body, either via the pipeline, or somewhere else?

10x

yassa
  • 68
  • 4
  • Found a possible solution: at pipeline.js, at function makeHTTPRequest() inside return consumeBody.then(function (body) { The consumed body is used in the new httpRequest, but never re-assigned to the original request, which causes it to remain as _bodyUsed=true, but with body = null. Adding request.body = body; just before creating the new httpRequest resolves the issue, and makes the body accessible via the pipeline. – yassa Sep 24 '15 at 06:02

0 Answers0