This package would be more helpful if it distinguished between identical requests with different headers. To accomplish this, we can add a new optional parameter to Session called requiredHeaders:
Only the headers specified in the requiredHeaders parameter will be used to select the response in the cassette. This is because other request headers (like User-Agent) change often and would make testing more difficult. This is useful when a test needs to hit the same endpoint multiple times and expects different responses based on the request headers.
This package would be more helpful if it distinguished between identical requests with different headers. To accomplish this, we can add a new optional parameter to
Session
calledrequiredHeaders
:Only the headers specified in the
requiredHeaders
parameter will be used to select the response in the cassette. This is because other request headers (like User-Agent) change often and would make testing more difficult. This is useful when a test needs to hit the same endpoint multiple times and expects different responses based on the request headers.