Configurable Headers for All Requests to PayPal

- Allows adding additional headers to every call to PayPal APIs.
- Refactored OAuthTokenCredential to share code for making Rest Calls
- SDK Config to add headers with http.headers.* syntax
- Fixes #193
This commit is contained in:
japatel
2014-12-17 15:36:41 -06:00
parent 515b747223
commit 20038e7525
8 changed files with 170 additions and 52 deletions

View File

@@ -84,6 +84,11 @@ class RestHandler implements IPPHandler
if ($httpConfig->getMethod() == 'POST' || $httpConfig->getMethod() == 'PUT') {
$httpConfig->addHeader('PayPal-Request-Id', $this->apiContext->getRequestId());
}
// Add any additional Headers that they may have provided
$headers = $this->apiContext->getRequestHeaders();
foreach ($headers as $key => $value) {
$httpConfig->addHeader($key, $value);
}
}
/**