Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fresh/tests/deps.ts>Page#waitForRequest

The next-gen web framework.
Extremely Popular
Go to Latest
method Page.prototype.waitForRequest
Re-export
import { Page } from "https://deno.land/x/fresh@1.4.3/tests/deps.ts";

Examples

Example 1

const firstResponse = await page.waitForResponse(
  'https://example.com/resource'
);
const finalResponse = await page.waitForResponse(
  response =>
    response.url() === 'https://example.com' && response.status() === 200
);
const finalResponse = await page.waitForResponse(async response => {
  return (await response.text()).includes('<html>');
});
return finalResponse.ok();

Parameters

urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise<boolean>)
  • A URL or predicate to wait for
optional
options: { timeout?: number; }
  • Optional waiting parameters

Returns

Promise<HTTPRequest>

Promise which resolves to the matched response