I created a service and it works as well.
A piece of my code from "event_subscriber":
public function addRequestAddValue(GetResponseEvent $event) {
$request = $event->getRequest();
$request->query->add(['key' => '123']);
}
And than I try get this param on my Controller all Ok:
$key = \Drupal::request()->query->get('key');
dsm($key); // return 123
But if I try get URL I can see only:
$url = \Drupal::request()->getUri();
dsm($url); //return http://localhoct.dv/patn
What I need do to get URI with GET param?
Thanks
Request::getUri()
adds the query parameter to its output.