Skip to content

Commit 6c9d703

Browse files
committed
Fix the #237 and #236
1 parent 01906e3 commit 6c9d703

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/Core/HttpClients/IntuitResponse.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ private function setResponseAsItIs($passedHeaders, $passedBody, $passedHttpRespo
8686
$this->headers = $passedHeaders;
8787
$this->body = $passedBody;
8888
$this->httpResponseCode = $passedHttpResponseCode;
89-
$this->setContentType(CoreConstants::CONTENT_TYPE, $passedHeaders[CoreConstants::CONTENT_TYPE]);
90-
$this->setIntuitTid(CoreConstants::INTUIT_TID, $passedHeaders[CoreConstants::INTUIT_TID]);
89+
$passedHeaders = array_change_key_case($passedHeaders, CASE_LOWER);
90+
$this->setContentType(CoreConstants::CONTENT_TYPE, $passedHeaders[strtolower(CoreConstants::CONTENT_TYPE)]);
91+
$this->setIntuitTid(CoreConstants::INTUIT_TID, $passedHeaders[strtolower(CoreConstants::INTUIT_TID)]);
9192
$this->setFaultHandler($passedBody, $passedHttpResponseCode, $this->getIntuitTid());
9293
}else{
9394
throw new SdkException("Passed Headers, body, or status code is Null.");

src/Core/HttpClients/SyncRestHandler.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ private function OAuth2APICall($baseURL, $queryParameters, $HttpMethod, $request
206206
$intuitResponse = $this->httpClientInterface->makeAPICall($requestUri, $HttpMethod, $httpHeaders, $requestBody, null, true);
207207
$faultHandler = $intuitResponse->getFaultHandler();
208208
$this->LogAPIResponseToLog($intuitResponse->getBody(), $requestUri, $intuitResponse->getHeaders());
209+
209210
//Based on the ducomentation, the fetch expected HTTP/1.1 20X or a redirect. If not, any 3xx, 4xx or 5xx will throw an OAuth Exception
210211
//for 3xx without direct, it will throw a 503 code and error saying: Invalid protected resource url, unable to generate signature base string
211212
if($faultHandler) {
@@ -267,8 +268,9 @@ private function setCommonHeadersForPHPSDK($AuthorizationHeader, $requestUri, $C
267268
* @param Array $httpHeaders The headers for the request
268269
*/
269270
public function LogAPIResponseToLog($body, $requestUri, $httpHeaders){
270-
if(strcasecmp($httpHeaders[CoreConstants::CONTENT_TYPE], CoreConstants::CONTENTTYPE_APPLICATIONXML) == 0 ||
271-
strcasecmp($httpHeaders[CoreConstants::CONTENT_TYPE], CoreConstants::CONTENTTYPE_APPLICATIONXML_WITH_CHARSET) == 0){
271+
$httpHeaders = array_change_key_case($httpHeaders, CASE_LOWER);
272+
if(strcasecmp($httpHeaders[strtolower(CoreConstants::CONTENT_TYPE)], CoreConstants::CONTENTTYPE_APPLICATIONXML) == 0 ||
273+
strcasecmp($httpHeaders[strtolower(CoreConstants::CONTENT_TYPE)], CoreConstants::CONTENTTYPE_APPLICATIONXML_WITH_CHARSET) == 0){
272274
$body = $this->parseStringToDom($body);
273275
}
274276

0 commit comments

Comments
 (0)