source: trip-planner-front/node_modules/@angular-devkit/build-angular/src/dev-server/tests/execute-fetch.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9var __importDefault = (this && this.__importDefault) || function (mod) {
10 return (mod && mod.__esModule) ? mod : { "default": mod };
11};
12Object.defineProperty(exports, "__esModule", { value: true });
13exports.executeOnceAndFetch = void 0;
14const node_fetch_1 = __importDefault(require("node-fetch")); // eslint-disable-line import/no-extraneous-dependencies
15const operators_1 = require("rxjs/operators");
16const url_1 = require("url");
17async function executeOnceAndFetch(harness, url, options) {
18 return harness
19 .execute()
20 .pipe(operators_1.timeout(30000), operators_1.mergeMap(async (executionResult) => {
21 var _a;
22 let response = undefined;
23 if ((_a = executionResult.result) === null || _a === void 0 ? void 0 : _a.success) {
24 const resolvedUrl = new url_1.URL(url, `${executionResult.result.baseUrl}/`);
25 response = await node_fetch_1.default(resolvedUrl, options === null || options === void 0 ? void 0 : options.request);
26 }
27 return { ...executionResult, response };
28 }), operators_1.take(1))
29 .toPromise();
30}
31exports.executeOnceAndFetch = executeOnceAndFetch;
Note: See TracBrowser for help on using the repository browser.