From 7bd2c607dd5aba82f4afb94a5c2e35ba5f0738cf Mon Sep 17 00:00:00 2001 From: Marcos Casagrande Date: Thu, 10 Nov 2022 00:31:14 +0100 Subject: fix(ext/response): make error, json, redirect enumerable (#16497) --- ext/fetch/23_response.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ext/fetch') diff --git a/ext/fetch/23_response.js b/ext/fetch/23_response.js index d5adb8042..542a62020 100644 --- a/ext/fetch/23_response.js +++ b/ext/fetch/23_response.js @@ -34,6 +34,7 @@ const { ArrayPrototypeMap, ArrayPrototypePush, + ObjectDefineProperties, ObjectPrototypeIsPrototypeOf, RangeError, RegExp, @@ -287,7 +288,7 @@ * @param {ResponseInit} init * @returns {Response} */ - static json(data, init = {}) { + static json(data = undefined, init = {}) { const prefix = "Failed to call 'Response.json'"; data = webidl.converters.any(data); init = webidl.converters["ResponseInit_fast"](init, { @@ -435,6 +436,11 @@ } webidl.configurePrototype(Response); + ObjectDefineProperties(Response, { + json: { enumerable: true }, + redirect: { enumerable: true }, + error: { enumerable: true }, + }); const ResponsePrototype = Response.prototype; mixinBody(ResponsePrototype, _body, _mimeType); -- cgit v1.2.3