I faced problem when trying to connect to Host which requires Basic Auth and couldn't find any way to config this header in this project. I checked and found that we initiate Guzzle Client inside class HttpRequestManager which is not good. Sometimes we need to configurate something such as authentication or proxy. It would be great if we can allow developer inject config there. Of course, there are some config we don't want to developer to change, we can forbid them to do that but still allow them to change the rest
/**
* construct
*
* @param string $host
* @param int $timeout
* @return void
*/
public function __construct($host, $timeout = 1)
{
parent::__construct($host, $timeout);
$this->client = new Client;
}
For now I have to create new class which inherits class HttpRequestManager and inject config there
/**
* construct
*
* @param string $host
* @param int $timeout
* @param string $apiSecret
*/
public function __construct($host, $timeout = 1, $config = [])
{
parent::__construct($host, $timeout);
// We can do some filters here for $config before transferring to Client
$this->client = new Client($config);
}
I faced problem when trying to connect to Host which requires Basic Auth and couldn't find any way to config this header in this project. I checked and found that we initiate Guzzle Client inside class HttpRequestManager which is not good. Sometimes we need to configurate something such as authentication or proxy. It would be great if we can allow developer inject config there. Of course, there are some config we don't want to developer to change, we can forbid them to do that but still allow them to change the rest
For now I have to create new class which inherits class HttpRequestManager and inject config there