@@ -206,6 +206,7 @@ private function OAuth2APICall($baseURL, $queryParameters, $HttpMethod, $request
206
206
$ intuitResponse = $ this ->httpClientInterface ->makeAPICall ($ requestUri , $ HttpMethod , $ httpHeaders , $ requestBody , null , true );
207
207
$ faultHandler = $ intuitResponse ->getFaultHandler ();
208
208
$ this ->LogAPIResponseToLog ($ intuitResponse ->getBody (), $ requestUri , $ intuitResponse ->getHeaders ());
209
+
209
210
//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
210
211
//for 3xx without direct, it will throw a 503 code and error saying: Invalid protected resource url, unable to generate signature base string
211
212
if ($ faultHandler ) {
@@ -267,8 +268,9 @@ private function setCommonHeadersForPHPSDK($AuthorizationHeader, $requestUri, $C
267
268
* @param Array $httpHeaders The headers for the request
268
269
*/
269
270
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 ){
272
274
$ body = $ this ->parseStringToDom ($ body );
273
275
}
274
276
0 commit comments