private function prepareRequest(Step $step, ValueBag $values, RequestInterface $request, $options)
{
$options['allow_redirects'] = false;
if (!$step->getDelay()) {
$options['delay'] = 0;
} else {
try {
$options['delay'] = $this->language->evaluate($step->getDelay(), $values->all(true));
} catch (ExpressionSyntaxError $e) {
$msg = sprintf('Delay syntax error in "%s": %s', $step->getDelay(), $e->getMessage());
$this->logger and $this->logger->critical($msg, ['request' => $request->getHeaderLine('X-Request-Id')]);
throw new InvalidArgumentException($msg);
}
}
unset($options['expectations']);
if ($step->getExpectations()) {
$options['expectations'] = $step->getExpectations();
}
unset($options['extractions']);
if ($step->getExtractions()) {
$options['extractions'] = $step->getExtractions();
}
foreach ($this->extensions as $extension) {
$options = $extension->prepareRequest($step, $values, $request, $options);
}
return $options;
}