Ideas

Configure SSL verification in Zed Request client

Problem

In order to run our tests in our CI environment with HTTPS we need to use self-signed certificates, and we need to disable verify in the Guzzle client, but this value is hard-coded in the request client.

As a result we have had to override the entire HTTP client.

Solution?

Add a new config option e.g. ZedRequestConstants::VERIFY_SSL_CONNECTION and implement as follows:

class AbstractHttpClient
{
    // ...
    protected function sendRequest(MessageRequestInterface $request, ObjectInterface $requestTransfer, $timeoutInSeconds = null)
    {
        $handlerStackContainer = new HandlerStackContainer();
        $config = [
            'timeout' => ($timeoutInSeconds ?: static::$timeoutInSeconds),
            'connect_timeout' => 1.5,
            'handler' => $handlerStackContainer->getHandlerStack(),
            'verify' => Config::get(ZedRequestConstants::VERIFY_SSL_CONNECTION, true)
        ];
  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Nov 28 2018
  • Shipped