@@ -2558,6 +2558,9 @@ protected function afterRequestDebug(string $method, string $url, string $postDa
25582558 {
25592559 if ($ this ->debug ) {
25602560
2561+ // normalize the line breaks
2562+ $ result = str_replace ('\r\n ' , '\n ' , trim ($ result ));
2563+
25612564 // request
25622565 $ this ->debugMessages ['Request ' ] = "$ method $ url " ;
25632566 $ body = [];
@@ -2566,7 +2569,8 @@ protected function afterRequestDebug(string $method, string $url, string $postDa
25662569
25672570 // request headers
25682571 $ rawRequest = curl_getinfo ($ this ->curl_handle , CURLINFO_HEADER_OUT );
2569- $ lines = explode (PHP_EOL , trim ($ rawRequest ));
2572+ $ rawRequest = str_replace ('\r\n ' , '\n ' , trim ($ rawRequest ));
2573+ $ lines = explode ('\n ' , $ rawRequest );
25702574 array_shift ($ lines ); // remove the first line and keep the headers
25712575 $ headers = [];
25722576 foreach ($ lines as $ line ) {
@@ -2588,8 +2592,8 @@ protected function afterRequestDebug(string $method, string $url, string $postDa
25882592 $ this ->debugMessages ['Response Code ' ] = curl_getinfo ($ this ->curl_handle , CURLINFO_HTTP_CODE );
25892593
25902594 // Response Headers and body
2591- [$ rawHeaders , $ body ] = explode (PHP_EOL . PHP_EOL , $ result );
2592- $ lines = explode (PHP_EOL , trim ($ rawHeaders ));
2595+ [$ rawHeaders , $ body ] = explode (' \n\n ' , $ result );
2596+ $ lines = explode (' \n ' , trim ($ rawHeaders ));
25932597 array_shift ($ lines );
25942598 $ headers = [];
25952599 foreach ($ lines as $ line ) {
0 commit comments