Skip to main content
Module

x/puppeteer/mod.ts>HTTPRequest#respond

A port of puppeteer running on Deno
Latest
method HTTPRequest.prototype.respond
Re-export
import { HTTPRequest } from "https://deno.land/x/puppeteer@16.2.0/mod.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

response: Partial<ResponseForRequest>
  • the response to fulfill the request with.
optional
priority: number
  • If provided, intercept is resolved using cooperative handling rules. Otherwise, intercept is resolved immediately.

Returns

Promise<void>