Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Added the ability to set options for guzzle #965

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@
}
],
"require": {
"php": ">=5.6",
"php": ">=7.2",
"pear/net_url2": "^2.2",
"pear/mail_mime": "^1.10",
"firebase/php-jwt": "^4.0 || ^5.0",
"microsoft/azure-storage": "^0.19.1",
"guzzlehttp/guzzle": "^6.2",
"zendframework/zend-mime": "^2.6",
"zendframework/zend-mail": "^2.7"
"microsoft/azure-storage-blob": "^1.0",
"microsoft/azure-storage-file": "^1.0",
"microsoft/azure-storage-queue": "^1.0",
"microsoft/azure-storage-table": "^1.0",
"guzzlehttp/guzzle": "^6.2 || ^7.0.1",
"laminas/laminas-mime": "^2.6",
"laminas/laminas-mail": "^2.7"
},
"require-dev": {
"mikey179/vfsStream": "^1.6",
Expand Down
6 changes: 5 additions & 1 deletion src/Common/Internal/Http/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ class HttpClient implements IHttpClient
*
* @param string $certificatePath The certificate path
* @param string $certificateAuthorityPath The path of the certificate authority
* @param array $options Array of options for guzzle
*/
public function __construct(
$certificatePath = Resources::EMPTY_STRING,
$certificateAuthorityPath = Resources::EMPTY_STRING
$certificateAuthorityPath = Resources::EMPTY_STRING,
$options = array()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, declare the argument type.

) {
$this->_config = [
Resources::USE_BRACKETS => true,
Expand All @@ -127,6 +129,8 @@ public function __construct(

$this->_requestUrl = null;
$this->_expectedStatusCodes = [];

$this->_config = array_merge($this->_config, $options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the provided options be validated before hydrating $this->_config? (by instance, with an options resolver). BTW, if they are intended to be an associative array, + operator could be used instead of calling array_merge().

}

/**
Expand Down
10 changes: 6 additions & 4 deletions src/Common/ServicesBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ class ServicesBuilder
/**
* Gets the HTTP client used in the REST services construction.
*
* @param array $options Array of options for guzzle
*
* @return IHttpClient
*/
protected function httpClient()
protected function httpClient($options = array())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, this is a BC break (the method is extensible).

{
return new HttpClient();
return new HttpClient(Resources::EMPTY_STRING, Resources::EMPTY_STRING, $options);
}

/**
Expand Down Expand Up @@ -216,13 +218,13 @@ public function createTableService($connectionString)
*
* @return IServiceBus
*/
public function createServiceBusService($connectionString)
public function createServiceBusService($connectionString, $options = array())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, this is a BC break (the method is extensible).

{
$settings = ServiceBusSettings::createFromConnectionString(
$connectionString
);

$httpClient = $this->httpClient();
$httpClient = $this->httpClient($options);
$serializer = $this->serializer();
$serviceBusWrapper = new ServiceBusRestProxy(
$httpClient,
Expand Down