Response: formData() method

The formData() method of the Response interface takes a Response stream and reads it to completion. It returns a promise that resolves with a FormData object.

Note: This is mainly relevant to service workers. If a user submits a form and a service worker intercepts the request, you could for example call formData() on it to obtain a key-value map, modify some fields, then send the form onwards to the server (or use it locally).

Syntax

js

formData()

Parameters

None.

Return value

A Promise that resolves with a FormData object.

Examples

TBD.

Specifications

Specification
Fetch Standard
# ref-for-dom-body-formdata①

Browser compatibility

BCD tables only load in the browser

See also