You are here

public function HttpClientManagerEventSubscriber::onCommandBeforePrepare in HTTP Client Manager 8

Command before-prepare event handler

Parameters

\Guzzle\Common\Event $event: Event received

File

src/EventSubscriber/HttpClientManagerEventSubscriber.php, line 32

Class

HttpClientManagerEventSubscriber
Class HttpClientManagerEventSubscriber.

Namespace

Drupal\http_client_manager\EventSubscriber

Code

public function onCommandBeforePrepare(Event $event) {

  /** @var OperationCommand $command */
  $command = $event['command'];
  $description = $command
    ->getClient()
    ->getDescription();
  $command
    ->set(OperationCommand::HEADERS_OPTION, [
    HttpClientInterface::HEADER_API => $description
      ->getName(),
    HttpClientInterface::HEADER_COMMAND => $command
      ->getName(),
  ]);
}