}> */ public array $requests = []; /** @param \Closure(string, string, array): HttpResponse $route */ public function __construct(JsBridge $bridge, private \Closure $route) { parent::__construct($bridge); } public function request(string $method, string $url, string|array|null $body = null, array $headers = [], ?float $timeout = null): Task { $this->requests[] = ['method' => $method, 'url' => $url, 'headers' => $headers]; $t = new Task(); $t->settle(($this->route)($method, $url, $headers)); return $t; } /** @return list the addresses asked, in order */ public function urls(): array { return array_map(fn (array $r) => $r['url'], $this->requests); } }