[Test-Proxy] Preserve original format when returning recorded response body content #5968
Labels
feature-request
This issue requires a new behavior in the product in order be resolved.
Test-Proxy
Anything relating to test-proxy requests or issues.
Milestone
Context
Python's
azure-containerregistry
library has tests that read a JSON manifest file and send this content to the service. The service creates a digest based on the stream content that was sent; this content is whitespace-dependent. Therefore, the digest we get from e.g.manifest_spaces.json
:will not match the digest we get from e.g.
manifest_no_spaces.json
:This is because the former digest is calculated with additional spaces in the stream.
In live mode, tests that validate the locally-calculated digest with the service-returned digest succeed when using
manifest_spaces.json
, since spaces are used in both digest calculations. The problem is that these tests fail in playback -- we calculate the local digest using spaces, but the recorded service response is returned without spaces by the test proxy.For example, here's a recorded manifest from a response body (source from the assets repository):
When the test proxy sends the response body content in playback, the recorded JSON is written back without any whitespace -- no spaces between keys and values. Because of this, the digest that's calculated from the response body differs from the one calculated from the local manifest file.
Feature request
If we had a way to request a certain formatting of the response body, for example with a regular expression, we could preserve the actual response body format in playback. As things stand, the response body content in live mode doesn't exactly match the response body content in playback.
@scbedd I could probably help with this, but I would need assistance in figuring out where exactly the response body is fetched from the recording and sent back to the test.
The text was updated successfully, but these errors were encountered: