The accepted answer didn't work for me (Laravel 11.33.2 - no-auth), but this did:
$this->get(url()->query('/path/to/api', [ 'key' => 'value', 'search' => 'username', ]));
Here's the Laravel URL Generation docs.