acoulton/mimic — Issue #5: Matching fails when Request_Client_Stream adds a content-length header
Author: acoulton
Created: 2011-12-30 13:27:54+00:00
State: open

Request_Client_Stream always adds a content-length header to the Request during execution, but Request_Client_Mimic does not.

This means Mimic fails to match a request definition that was recorded with Request_Client_Stream (because there is no content-length header in the Kohana request before execution). If recording is enabled, Mimic tries to record and executes the request. Now, however, the request does match because the content-length header is present, so Mimic will try to update the existing definition and fail if updating is disabled.

Possible resolutions would be:

* Take a copy of the Request object prior to execution, but this would mean having to duplicate assigning a response etc.
* Always set a content-length header in Request_Client_Mimic prior to trying to match the request.

The latter is probably the least likely to cause problems in future.