@@ -2558,6 +2558,9 @@ protected function afterRequestDebug(string $method, string $url, string $postDa
2558
2558
{
2559
2559
if ($ this ->debug ) {
2560
2560
2561
+ // normalize the line breaks
2562
+ $ result = str_replace ('\r\n ' , '\n ' , trim ($ result ));
2563
+
2561
2564
// request
2562
2565
$ this ->debugMessages ['Request ' ] = "$ method $ url " ;
2563
2566
$ body = [];
@@ -2566,7 +2569,8 @@ protected function afterRequestDebug(string $method, string $url, string $postDa
2566
2569
2567
2570
// request headers
2568
2571
$ 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 );
2570
2574
array_shift ($ lines ); // remove the first line and keep the headers
2571
2575
$ headers = [];
2572
2576
foreach ($ lines as $ line ) {
@@ -2588,8 +2592,8 @@ protected function afterRequestDebug(string $method, string $url, string $postDa
2588
2592
$ this ->debugMessages ['Response Code ' ] = curl_getinfo ($ this ->curl_handle , CURLINFO_HTTP_CODE );
2589
2593
2590
2594
// 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 ));
2593
2597
array_shift ($ lines );
2594
2598
$ headers = [];
2595
2599
foreach ($ lines as $ line ) {
0 commit comments