Skip to content

Commit

Permalink
Display all body responses in the logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinamiko committed May 12, 2022
1 parent baef2d5 commit a58e971
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/ppcp-api-client/src/Endpoint/RequestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ private function request_response_string( string $url, array $args, $response ):
if ( isset( $response['response'] ) ) {
$output .= 'Response: ' . wc_print_r( $response['response'], true ) . "\n";

if ( isset( $response['body'] )
if (
isset( $response['body'] )
&& isset( $response['response']['code'] )
&& ! in_array( $response['response']['code'], array( 200, 201, 202, 204 ), true ) ) {
) {
$output .= 'Response Body: ' . wc_print_r( $response['body'], true ) . "\n";
}
}
Expand Down

0 comments on commit a58e971

Please sign in to comment.