sdk headers causing vcr tests to fail when change in php version
the-dijkstra opened this issue · comments
VCR is a PHP library used to mock requests to third-party APIs.
if you are using VCR for your project to mock request to PayPal using Http Paypal Client
the request will include some extra headers :
/**
* Inject Paypal SDK headers into the request.
*
* @return \GuzzleHttp\Psr7\Request
*/
public function injectSdkHeaders(Request $request)
{
return $request->withHeader('sdk_name', 'Checkout SDK')
->withHeader('sdk_version', '1.0.0')
->withHeader('sdk_tech_stack', 'PHP '.PHP_VERSION);
}
as you see the sdk_tech_stack
header is injecting the runtime PHP version. wich is causing VCR tests to fail when using different environments to run tests (ex: Local running on PHP 7.4.16
, Github action running on PHP 7.4.18
)
a quick fix for this would be to detect if the environment is a sandbox environment and not inject those headers.