Skip to content

Commit

Permalink
adding error handling to the RetryHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
david-schrenker committed Dec 11, 2023
1 parent 2037ad3 commit abb703b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
use Socketlabs\Message\BasicMessage;

$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//$client->proxyUrl = exampleConfig::proxy(); //Uncomment to configure a proxy such as fiddler
// $client->proxyUrl = exampleConfig::proxy(); //Uncomment to configure a proxy
// $client->exampleConfig::endpoint() //Uncomment to configure a different endpoint address

//Build the message
$message = new BasicMessage();
Expand Down
8 changes: 7 additions & 1 deletion InjectionApi/src/Core/RetryHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ public function send(){

$context = stream_context_create($this->httpClient);
$response = @file_get_contents($this->endpointUrl, FALSE, $context);
return array($response, $http_response_header);

if (isset($http_response_header)) {
return array($response, $http_response_header);
}
else {
return array($response);
}

}

Expand Down
2 changes: 1 addition & 1 deletion InjectionApi/src/SocketLabsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SocketLabsClient{
private $serverId;
private $apiKey;

const VERSION = "1.4.4";
const VERSION = "1.4.5";
public $version = self::VERSION;

/**
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ For more information about AMP please see [AMP Project](https://amp.dev/document

<a name="version"></a>
# Version
* 1.4.5 - Adding error handling on RetryHandler
* 1.4.4 - Removed Debugging Code
* 1.4.3 - Added MetadataOrTagsAreTooLarge error messsage
* 1.4.2 - Adding API Key Authorization
Expand Down

0 comments on commit abb703b

Please sign in to comment.