Skip to content

Pass optional response headers to StreamedResponse()

Closes #3202847 by allowing optional headers in print engine configuration, which could be set by a custom print engine or by an event subscriber subscribing to the PrintEvents::CONFIGURATION_ALTER event, see sample code:

  /**
   * React to a event fired when retrieving a Print engine configuration.
   *
   * @param \Symfony\Component\EventDispatcher\GenericEvent $event
   *   Generic event containing the print engine configuration.
   */
  public function onConfigurationAlter(GenericEvent $event) {
    $configuration = $event->getArgument('configuration');
    // Set the X-Robot-Tag to noindex.
    $configuration['headers']['X-Robot-Tag'] = 'nofollow';
    $event->setArgument('configuration', $configuration);
  }

Merge request reports