Request: clone() method - Web APIs | MDN

Syntax

Parameters

None.

Return value

A Request object, which is an exact copy of the Request that clone() was called on.

Examples

In the following snippet, we create a new request using the Request() constructor (for an image file in the same directory as the script), then clone the request.

js

const myRequest = new Request("flowers.jpg");
const newRequest = myRequest.clone(); // a copy of the request is now stored in newRequest

Specifications

Specification
Fetch
# ref-for-dom-request-clone①

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.