PHP Classes

File: modules/system/tests/js/helpers/FetchMock.js

Recommend this page to a friend!
  Packages of Luke Towers   Winter   modules/system/tests/js/helpers/FetchMock.js   Download  
File: modules/system/tests/js/helpers/FetchMock.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Winter
Content management system that uses MVC
Author: By
Last change:
Date: 6 months ago
Size: 679 bytes
 

Contents

Class file image Download
export default function (dom, statusCode, body, headers, jsonPromise, textPromise) { return function () { return Promise.resolve({ ok: statusCode >= 200 && statusCode < 300, status: statusCode, headers: new dom.window.Headers(headers), json: () => { if (jsonPromise) { return jsonPromise; } return Promise.resolve(JSON.parse(body)); }, text: () => { if (textPromise) { return textPromise; } return Promise.resolve(body); }, }); } };