Skip to main content
Deno 2 is finally here 🎉️
Learn more
Latest
method HTTPRequest.prototype.respond
import { HTTPRequest } from "https://deno.land/x/pptr@1.2.0/src/HTTPRequest.ts";

Fulfills a request with the given response.

Examples

An example of fulfilling all requests with 404 responses:

await page.setRequestInterception(true);
page.on('request', request => {
  request.respond({
    status: 404,
    contentType: 'text/plain',
    body: 'Not Found!'
  });
});

NOTE: Mocking responses for dataURL requests is not supported. Calling request.respond for a dataURL request is a noop.

Parameters

  • the response to fulfill the request with.

Returns

Promise<void>