Before these changes, if the request body or URL contained a list of params that were in a different order than the params in the cassette, the request would fail to match the cassette.
As of OTP 26, map key order is not guaranteed, so request bodies and URL params that are created using maps can fail to match since the order of their keys is not idempotent.
These changes convert the request body and URL params to a sorted list before comparing it to the request body and URL in the cassette. This ensures cassettes will be matched as long as their request bodies and URL params contain the same set of key-value pairs as the incoming request.
coverage: 92.419% (+0.2%) from 92.248% when pulling a1d9dbc1d35f391fe1242cc6caf3d6a1cd3b407e on seated:pjb/normalize-response-body into 406af2df2842be49c30d4a9a3ce6620f9d4c2e17 on parroty:master.
coverage: 92.581% (+0.3%) from 92.248% when pulling a1d9dbc1d35f391fe1242cc6caf3d6a1cd3b407e on seated:pjb/normalize-response-body into 406af2df2842be49c30d4a9a3ce6620f9d4c2e17 on parroty:master.
Before these changes, if the request body or URL contained a list of params that were in a different order than the params in the cassette, the request would fail to match the cassette.
As of OTP 26, map key order is not guaranteed, so request bodies and URL params that are created using maps can fail to match since the order of their keys is not idempotent.
These changes convert the request body and URL params to a sorted list before comparing it to the request body and URL in the cassette. This ensures cassettes will be matched as long as their request bodies and URL params contain the same set of key-value pairs as the incoming request.