GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: add FormData global when fetch is enabled · nodejs/node@ec0d623

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .eslintrc.js
  • doc/api
    • globals.md
  • lib
    • .eslintrc.yaml
    • internal/bootstrap
      • pre_execution.js
  • test
    • common
      • index.js
    • parallel
      • test-fetch.mjs
    • wpt
      • test-url.js
  • tools/doc
    • type-parser.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.eslintrc.js‎

Copy file name to clipboardExpand all lines: .eslintrc.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ module.exports = {
319319
Crypto: 'readable',
320320
CryptoKey: 'readable',
321321
fetch: 'readable',
322+
FormData: 'readable',
322323
globalThis: 'readable',
323324
Response: 'readable',
324325
SubtleCrypto: 'readable',
Collapse file

‎doc/api/globals.md‎

Copy file name to clipboardExpand all lines: doc/api/globals.md
+11Lines changed: 11 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,17 @@ added: v17.5.0
363363
364364
A browser-compatible implementation of the [`fetch()`][] function.
365365

366+
## Class `FormData`
367+
368+
<!-- YAML
369+
added: REPLACEME
370+
-->
371+
372+
> Stability: 1 - Experimental. Enable this API with the [`--experimental-fetch`][]
373+
> CLI flag.
374+
375+
A browser-compatible implementation of {FormData}.
376+
366377
## `global`
367378

368379
<!-- YAML
Collapse file

‎lib/.eslintrc.yaml‎

Copy file name to clipboardExpand all lines: lib/.eslintrc.yaml
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ rules:
4747
message: Use `const { Event } = require('internal/event_target');` instead of the global.
4848
- name: EventTarget
4949
message: Use `const { EventTarget } = require('internal/event_target');` instead of the global.
50+
- name: FormData
51+
message: Use `const { FormData } = require('internal/deps/undici/undici');` instead of the global.
5052
- name: Headers
5153
message: Use `const { Headers } = require('internal/deps/undici/undici');` instead of the global.
5254
# Intl is not available in primordials because it can be
Collapse file

‎lib/internal/bootstrap/pre_execution.js‎

Copy file name to clipboardExpand all lines: lib/internal/bootstrap/pre_execution.js
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ function setupFetch() {
163163
configurable: true,
164164
value: undici.fetch
165165
});
166+
ObjectDefineProperty(globalThis, 'FormData', {
167+
writable: true,
168+
enumerable: false,
169+
configurable: true,
170+
value: undici.FormData
171+
});
166172
ObjectDefineProperty(globalThis, 'Headers', {
167173
writable: true,
168174
enumerable: false,
Collapse file

‎test/common/index.js‎

Copy file name to clipboardExpand all lines: test/common/index.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ if (global.structuredClone) {
303303
if (global.fetch) {
304304
knownGlobals.push(
305305
global.fetch,
306+
global.FormData,
306307
global.Request,
307308
global.Response,
308309
global.Headers,
Collapse file

‎test/parallel/test-fetch.mjs‎

Copy file name to clipboardExpand all lines: test/parallel/test-fetch.mjs
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import events from 'events';
77
import http from 'http';
88

99
assert.strictEqual(typeof globalThis.fetch, 'function');
10+
assert.strictEqual(typeof globalThis.FormData, 'function');
1011
assert.strictEqual(typeof globalThis.Headers, 'function');
1112
assert.strictEqual(typeof globalThis.Request, 'function');
1213
assert.strictEqual(typeof globalThis.Response, 'function');
Collapse file

‎test/wpt/test-url.js‎

Copy file name to clipboardExpand all lines: test/wpt/test-url.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runner.setScriptModifier((obj) => {
1111
// created via `document.createElement`. So we need to ignore them and just
1212
// test `URL`.
1313
obj.code = obj.code.replace(/\["url", "a", "area"\]/, '[ "url" ]');
14-
} else if (typeof FormData === 'undefined' && // eslint-disable-line
14+
} else if (typeof FormData === 'undefined' &&
1515
obj.filename.includes('urlsearchparams-constructor.any.js')) {
1616
// TODO(XadillaX): Remove this `else if` after `FormData` is supported.
1717

Collapse file

‎tools/doc/type-parser.mjs‎

Copy file name to clipboardExpand all lines: tools/doc/type-parser.mjs
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ const customTypesMap = {
271271
'TextDecoderStream':
272272
'webstreams.md#class-textdecoderstream',
273273

274+
'FormData': 'https://developer.mozilla.org/en-US/docs/Web/API/FormData',
274275
'Headers': 'https://developer.mozilla.org/en-US/docs/Web/API/Headers',
275276
'Response': 'https://developer.mozilla.org/en-US/docs/Web/API/Response',
276277
'Request': 'https://developer.mozilla.org/en-US/docs/Web/API/Request',

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.