Skip to content

Commit

Permalink
Aggiornato controllo http status code
Browse files Browse the repository at this point in the history
  • Loading branch information
Armando Caprio committed May 8, 2024
1 parent 54fc17e commit 545d4d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ vendor/
composer.lock
.DS_Store
nbproject/*
.idea
.idea
composer.phar
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private function curl( string $verb, string $request, JsonSerializable $json = n
throw new RequestFailureException( sprintf( 'Curl "%s%s" was wrong: [%s] %s', $this->Endpoint, $request, $curlErrorNumber, $curlErrorMessage ) );
}

if ( $httpStatusCode != 200 ) {
if ( !in_array($httpStatusCode, [200, 201, 204]) ) {
$errorMessage = new ErrorMessage( $result );
$exception = new RequestFailureException( sprintf( 'Http request "%s%s" was wrong. Code [%s] Message "%s"', $this->Endpoint, $request, $errorMessage->code, $errorMessage->message ) );
$exception->setResponse( $errorMessage );
Expand Down

0 comments on commit 545d4d2

Please sign in to comment.