Behat / WebApiExtension

Behat extension to test web APIs
http://extensions.behat.org
MIT License
111 stars 114 forks source link

Guzzle configuration: verify #63

Open DrSchimke opened 8 years ago

DrSchimke commented 8 years ago

I want to be able to disable the certification verification for guzzle client

greg0ire commented 8 years ago

Shouldn't you be using this value somewhere, like maybe in #32 ? Apparently it should be enough indeed

jcornide commented 7 years ago

It would be great if this is merged, I'm using a workaround and this could be quite helpful

forceedge01 commented 6 years ago

Can the maintainer please accept this PR? Its been open since 2016.. not cool to be honest.

forceedge01 commented 6 years ago

For now overriding config with reflection - but honestly when the maintainer wakes up - please merge PR.

forceedge01 commented 6 years ago

For now resorting to this:

        $api = $this->getExternalContext(WebApiContext::class);

        $reflection = new ReflectionObject($api);
        $reflectionMethod = $reflection->getMethod('getClient');
        $reflectionMethod->setAccessible(true);
        $client = $reflectionMethod->invoke($api);

        $reflection = new ReflectionObject($client);
        $reflectionProperty = $reflection->getProperty('config');
        $reflectionProperty->setAccessible(true);
        $config = $reflectionProperty->getValue($client);
        $config['verify'] = false;

        $reflectionProperty->setValue($client, $config);