Repository: symfony/symfony
File: src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php (PHP)

Code before:
        }

        if (\is_object($controller)) {
            $r = new \ReflectionClass($controller);

            return [
                'class' => $r->getName(),
                'method' => null,
                'file' => $r->getFileName(),
                'line' => $r->getStartLine(),
            ];
        }

        return \is_string($controller) ? $controller : 'n/a';
    }

    private function computeCurlCommand(Request $request): ?string
    {
        $command = ['curl', '--compressed'];

        // Build the full URL
        $scheme = $request->isSecure() ? 'https' : 'http';
        $host = $request->server->get('HTTP_HOST', $request->server->get('SERVER_NAME', 'localhost'));
        $url = $scheme.'://'.$host.$request->getRequestUri();

        if (!empty($request->query->all())) {
            $url .= '?'.http_build_query($request->query->all());
        }

        // Add HTTP method
        $method = $request->getMethod();
        switch ($method) {
            case Request::METHOD_HEAD:
                $command[] = '--head';
                break;
            case Request::METHOD_GET:
                break;
            default:
                $command[] = \sprintf('--request %s', $method);
        }

        $command[] = \sprintf('--url %s', escapeshellarg($url));

        // Add headers
        foreach ($request->headers->all() as $name => $value) {
            if (\is_array($value)) {
                $value = implode(', ', $value);
            }

            // Skip certain headers
            if (\in_array(strtolower($name), ['host', 'cookie'])) {

Review comment (suggestion):
```suggestion
        if ($request->query->all()) {
```

Code after:
        }

        if (\is_object($controller)) {
            $r = new \ReflectionClass($controller);

            return [
                'class' => $r->getName(),
                'method' => null,
                'file' => $r->getFileName(),
                'line' => $r->getStartLine(),
            ];
        }

        return \is_string($controller) ? $controller : 'n/a';
    }

    private function computeCurlCommand(Request $request, ?string $content): string
    {
        $command = ['curl', '--compressed'];

        $method = $request->getMethod();

        if (Request::METHOD_HEAD === $method) {
            $command[] = '--head';
        } elseif (Request::METHOD_GET !== $method) {
            $command[] = \sprintf('--request %s', $method);
        }

        $command[] = \sprintf('--url %s', escapeshellarg($request->getUri()));

        foreach ($request->headers->all() as $name => $values) {
            if (\in_array(strtolower($name), ['host', 'cookie'], true)) {
                continue;
            }

            $command[] = '--header '.escapeshellarg(ucwords($name, '-').': '.implode(', ', $values));
        }

        if ($request->cookies->all()) {
            $cookies = [];
            foreach ($request->cookies->all() as $name => $value) {
                $cookies[] = urlencode($name).'='.urlencode($value);
            }
            $command[] = '--cookie '.escapeshellarg(implode('; ', $cookies));
        }

        if ($content && \in_array($method, [Request::METHOD_POST, Request::METHOD_PUT, Request::METHOD_PATCH, Request::METHOD_DELETE], true)) {
            $command[] = '--data-raw '.$this->escapePayload($content);
        }

        return implode(" \\\n  ", $command);