source: trip-planner-front/node_modules/@angular/common/bundles/common-http.umd.js@ fa375fe

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

initial commit

  • Property mode set to 100644
File size: 114.9 KB
RevLine 
[6a3a178]1/**
2 * @license Angular v12.2.9
3 * (c) 2010-2021 Google LLC. https://angular.io/
4 * License: MIT
5 */
6
7(function (global, factory) {
8 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('rxjs'), require('rxjs/operators')) :
9 typeof define === 'function' && define.amd ? define('@angular/common/http', ['exports', '@angular/common', '@angular/core', 'rxjs', 'rxjs/operators'], factory) :
10 (global = global || self, factory((global.ng = global.ng || {}, global.ng.common = global.ng.common || {}, global.ng.common.http = {}), global.ng.common, global.ng.core, global.rxjs, global.rxjs.operators));
11}(this, (function (exports, common, core, rxjs, operators) { 'use strict';
12
13 /**
14 * @license
15 * Copyright Google LLC All Rights Reserved.
16 *
17 * Use of this source code is governed by an MIT-style license that can be
18 * found in the LICENSE file at https://angular.io/license
19 */
20 /**
21 * Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a
22 * `HttpResponse`.
23 *
24 * `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the
25 * first interceptor in the chain, which dispatches to the second, etc, eventually reaching the
26 * `HttpBackend`.
27 *
28 * In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain.
29 *
30 * @publicApi
31 */
32 var HttpHandler = /** @class */ (function () {
33 function HttpHandler() {
34 }
35 return HttpHandler;
36 }());
37 /**
38 * A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend.
39 *
40 * Interceptors sit between the `HttpClient` interface and the `HttpBackend`.
41 *
42 * When injected, `HttpBackend` dispatches requests directly to the backend, without going
43 * through the interceptor chain.
44 *
45 * @publicApi
46 */
47 var HttpBackend = /** @class */ (function () {
48 function HttpBackend() {
49 }
50 return HttpBackend;
51 }());
52
53 /*! *****************************************************************************
54 Copyright (c) Microsoft Corporation.
55
56 Permission to use, copy, modify, and/or distribute this software for any
57 purpose with or without fee is hereby granted.
58
59 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
60 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
61 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
62 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
63 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
64 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
65 PERFORMANCE OF THIS SOFTWARE.
66 ***************************************************************************** */
67 /* global Reflect, Promise */
68 var extendStatics = function (d, b) {
69 extendStatics = Object.setPrototypeOf ||
70 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
71 function (d, b) { for (var p in b)
72 if (Object.prototype.hasOwnProperty.call(b, p))
73 d[p] = b[p]; };
74 return extendStatics(d, b);
75 };
76 function __extends(d, b) {
77 if (typeof b !== "function" && b !== null)
78 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
79 extendStatics(d, b);
80 function __() { this.constructor = d; }
81 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
82 }
83 var __assign = function () {
84 __assign = Object.assign || function __assign(t) {
85 for (var s, i = 1, n = arguments.length; i < n; i++) {
86 s = arguments[i];
87 for (var p in s)
88 if (Object.prototype.hasOwnProperty.call(s, p))
89 t[p] = s[p];
90 }
91 return t;
92 };
93 return __assign.apply(this, arguments);
94 };
95 function __rest(s, e) {
96 var t = {};
97 for (var p in s)
98 if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
99 t[p] = s[p];
100 if (s != null && typeof Object.getOwnPropertySymbols === "function")
101 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
102 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
103 t[p[i]] = s[p[i]];
104 }
105 return t;
106 }
107 function __decorate(decorators, target, key, desc) {
108 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
109 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
110 r = Reflect.decorate(decorators, target, key, desc);
111 else
112 for (var i = decorators.length - 1; i >= 0; i--)
113 if (d = decorators[i])
114 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
115 return c > 3 && r && Object.defineProperty(target, key, r), r;
116 }
117 function __param(paramIndex, decorator) {
118 return function (target, key) { decorator(target, key, paramIndex); };
119 }
120 function __metadata(metadataKey, metadataValue) {
121 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
122 return Reflect.metadata(metadataKey, metadataValue);
123 }
124 function __awaiter(thisArg, _arguments, P, generator) {
125 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
126 return new (P || (P = Promise))(function (resolve, reject) {
127 function fulfilled(value) { try {
128 step(generator.next(value));
129 }
130 catch (e) {
131 reject(e);
132 } }
133 function rejected(value) { try {
134 step(generator["throw"](value));
135 }
136 catch (e) {
137 reject(e);
138 } }
139 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
140 step((generator = generator.apply(thisArg, _arguments || [])).next());
141 });
142 }
143 function __generator(thisArg, body) {
144 var _ = { label: 0, sent: function () { if (t[0] & 1)
145 throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
146 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
147 function verb(n) { return function (v) { return step([n, v]); }; }
148 function step(op) {
149 if (f)
150 throw new TypeError("Generator is already executing.");
151 while (_)
152 try {
153 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
154 return t;
155 if (y = 0, t)
156 op = [op[0] & 2, t.value];
157 switch (op[0]) {
158 case 0:
159 case 1:
160 t = op;
161 break;
162 case 4:
163 _.label++;
164 return { value: op[1], done: false };
165 case 5:
166 _.label++;
167 y = op[1];
168 op = [0];
169 continue;
170 case 7:
171 op = _.ops.pop();
172 _.trys.pop();
173 continue;
174 default:
175 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
176 _ = 0;
177 continue;
178 }
179 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
180 _.label = op[1];
181 break;
182 }
183 if (op[0] === 6 && _.label < t[1]) {
184 _.label = t[1];
185 t = op;
186 break;
187 }
188 if (t && _.label < t[2]) {
189 _.label = t[2];
190 _.ops.push(op);
191 break;
192 }
193 if (t[2])
194 _.ops.pop();
195 _.trys.pop();
196 continue;
197 }
198 op = body.call(thisArg, _);
199 }
200 catch (e) {
201 op = [6, e];
202 y = 0;
203 }
204 finally {
205 f = t = 0;
206 }
207 if (op[0] & 5)
208 throw op[1];
209 return { value: op[0] ? op[1] : void 0, done: true };
210 }
211 }
212 var __createBinding = Object.create ? (function (o, m, k, k2) {
213 if (k2 === undefined)
214 k2 = k;
215 Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
216 }) : (function (o, m, k, k2) {
217 if (k2 === undefined)
218 k2 = k;
219 o[k2] = m[k];
220 });
221 function __exportStar(m, o) {
222 for (var p in m)
223 if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
224 __createBinding(o, m, p);
225 }
226 function __values(o) {
227 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
228 if (m)
229 return m.call(o);
230 if (o && typeof o.length === "number")
231 return {
232 next: function () {
233 if (o && i >= o.length)
234 o = void 0;
235 return { value: o && o[i++], done: !o };
236 }
237 };
238 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
239 }
240 function __read(o, n) {
241 var m = typeof Symbol === "function" && o[Symbol.iterator];
242 if (!m)
243 return o;
244 var i = m.call(o), r, ar = [], e;
245 try {
246 while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
247 ar.push(r.value);
248 }
249 catch (error) {
250 e = { error: error };
251 }
252 finally {
253 try {
254 if (r && !r.done && (m = i["return"]))
255 m.call(i);
256 }
257 finally {
258 if (e)
259 throw e.error;
260 }
261 }
262 return ar;
263 }
264 /** @deprecated */
265 function __spread() {
266 for (var ar = [], i = 0; i < arguments.length; i++)
267 ar = ar.concat(__read(arguments[i]));
268 return ar;
269 }
270 /** @deprecated */
271 function __spreadArrays() {
272 for (var s = 0, i = 0, il = arguments.length; i < il; i++)
273 s += arguments[i].length;
274 for (var r = Array(s), k = 0, i = 0; i < il; i++)
275 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
276 r[k] = a[j];
277 return r;
278 }
279 function __spreadArray(to, from, pack) {
280 if (pack || arguments.length === 2)
281 for (var i = 0, l = from.length, ar; i < l; i++) {
282 if (ar || !(i in from)) {
283 if (!ar)
284 ar = Array.prototype.slice.call(from, 0, i);
285 ar[i] = from[i];
286 }
287 }
288 return to.concat(ar || Array.prototype.slice.call(from));
289 }
290 function __await(v) {
291 return this instanceof __await ? (this.v = v, this) : new __await(v);
292 }
293 function __asyncGenerator(thisArg, _arguments, generator) {
294 if (!Symbol.asyncIterator)
295 throw new TypeError("Symbol.asyncIterator is not defined.");
296 var g = generator.apply(thisArg, _arguments || []), i, q = [];
297 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
298 function verb(n) { if (g[n])
299 i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
300 function resume(n, v) { try {
301 step(g[n](v));
302 }
303 catch (e) {
304 settle(q[0][3], e);
305 } }
306 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
307 function fulfill(value) { resume("next", value); }
308 function reject(value) { resume("throw", value); }
309 function settle(f, v) { if (f(v), q.shift(), q.length)
310 resume(q[0][0], q[0][1]); }
311 }
312 function __asyncDelegator(o) {
313 var i, p;
314 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
315 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
316 }
317 function __asyncValues(o) {
318 if (!Symbol.asyncIterator)
319 throw new TypeError("Symbol.asyncIterator is not defined.");
320 var m = o[Symbol.asyncIterator], i;
321 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
322 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
323 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
324 }
325 function __makeTemplateObject(cooked, raw) {
326 if (Object.defineProperty) {
327 Object.defineProperty(cooked, "raw", { value: raw });
328 }
329 else {
330 cooked.raw = raw;
331 }
332 return cooked;
333 }
334 ;
335 var __setModuleDefault = Object.create ? (function (o, v) {
336 Object.defineProperty(o, "default", { enumerable: true, value: v });
337 }) : function (o, v) {
338 o["default"] = v;
339 };
340 function __importStar(mod) {
341 if (mod && mod.__esModule)
342 return mod;
343 var result = {};
344 if (mod != null)
345 for (var k in mod)
346 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
347 __createBinding(result, mod, k);
348 __setModuleDefault(result, mod);
349 return result;
350 }
351 function __importDefault(mod) {
352 return (mod && mod.__esModule) ? mod : { default: mod };
353 }
354 function __classPrivateFieldGet(receiver, state, kind, f) {
355 if (kind === "a" && !f)
356 throw new TypeError("Private accessor was defined without a getter");
357 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
358 throw new TypeError("Cannot read private member from an object whose class did not declare it");
359 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
360 }
361 function __classPrivateFieldSet(receiver, state, value, kind, f) {
362 if (kind === "m")
363 throw new TypeError("Private method is not writable");
364 if (kind === "a" && !f)
365 throw new TypeError("Private accessor was defined without a setter");
366 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
367 throw new TypeError("Cannot write private member to an object whose class did not declare it");
368 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
369 }
370
371 /**
372 * @license
373 * Copyright Google LLC All Rights Reserved.
374 *
375 * Use of this source code is governed by an MIT-style license that can be
376 * found in the LICENSE file at https://angular.io/license
377 */
378 /**
379 * Represents the header configuration options for an HTTP request.
380 * Instances are immutable. Modifying methods return a cloned
381 * instance with the change. The original object is never changed.
382 *
383 * @publicApi
384 */
385 var HttpHeaders = /** @class */ (function () {
386 /** Constructs a new HTTP header object with the given values.*/
387 function HttpHeaders(headers) {
388 var _this = this;
389 /**
390 * Internal map of lowercased header names to the normalized
391 * form of the name (the form seen first).
392 */
393 this.normalizedNames = new Map();
394 /**
395 * Queued updates to be materialized the next initialization.
396 */
397 this.lazyUpdate = null;
398 if (!headers) {
399 this.headers = new Map();
400 }
401 else if (typeof headers === 'string') {
402 this.lazyInit = function () {
403 _this.headers = new Map();
404 headers.split('\n').forEach(function (line) {
405 var index = line.indexOf(':');
406 if (index > 0) {
407 var name = line.slice(0, index);
408 var key = name.toLowerCase();
409 var value = line.slice(index + 1).trim();
410 _this.maybeSetNormalizedName(name, key);
411 if (_this.headers.has(key)) {
412 _this.headers.get(key).push(value);
413 }
414 else {
415 _this.headers.set(key, [value]);
416 }
417 }
418 });
419 };
420 }
421 else {
422 this.lazyInit = function () {
423 _this.headers = new Map();
424 Object.keys(headers).forEach(function (name) {
425 var values = headers[name];
426 var key = name.toLowerCase();
427 if (typeof values === 'string') {
428 values = [values];
429 }
430 if (values.length > 0) {
431 _this.headers.set(key, values);
432 _this.maybeSetNormalizedName(name, key);
433 }
434 });
435 };
436 }
437 }
438 /**
439 * Checks for existence of a given header.
440 *
441 * @param name The header name to check for existence.
442 *
443 * @returns True if the header exists, false otherwise.
444 */
445 HttpHeaders.prototype.has = function (name) {
446 this.init();
447 return this.headers.has(name.toLowerCase());
448 };
449 /**
450 * Retrieves the first value of a given header.
451 *
452 * @param name The header name.
453 *
454 * @returns The value string if the header exists, null otherwise
455 */
456 HttpHeaders.prototype.get = function (name) {
457 this.init();
458 var values = this.headers.get(name.toLowerCase());
459 return values && values.length > 0 ? values[0] : null;
460 };
461 /**
462 * Retrieves the names of the headers.
463 *
464 * @returns A list of header names.
465 */
466 HttpHeaders.prototype.keys = function () {
467 this.init();
468 return Array.from(this.normalizedNames.values());
469 };
470 /**
471 * Retrieves a list of values for a given header.
472 *
473 * @param name The header name from which to retrieve values.
474 *
475 * @returns A string of values if the header exists, null otherwise.
476 */
477 HttpHeaders.prototype.getAll = function (name) {
478 this.init();
479 return this.headers.get(name.toLowerCase()) || null;
480 };
481 /**
482 * Appends a new value to the existing set of values for a header
483 * and returns them in a clone of the original instance.
484 *
485 * @param name The header name for which to append the values.
486 * @param value The value to append.
487 *
488 * @returns A clone of the HTTP headers object with the value appended to the given header.
489 */
490 HttpHeaders.prototype.append = function (name, value) {
491 return this.clone({ name: name, value: value, op: 'a' });
492 };
493 /**
494 * Sets or modifies a value for a given header in a clone of the original instance.
495 * If the header already exists, its value is replaced with the given value
496 * in the returned object.
497 *
498 * @param name The header name.
499 * @param value The value or values to set or overide for the given header.
500 *
501 * @returns A clone of the HTTP headers object with the newly set header value.
502 */
503 HttpHeaders.prototype.set = function (name, value) {
504 return this.clone({ name: name, value: value, op: 's' });
505 };
506 /**
507 * Deletes values for a given header in a clone of the original instance.
508 *
509 * @param name The header name.
510 * @param value The value or values to delete for the given header.
511 *
512 * @returns A clone of the HTTP headers object with the given value deleted.
513 */
514 HttpHeaders.prototype.delete = function (name, value) {
515 return this.clone({ name: name, value: value, op: 'd' });
516 };
517 HttpHeaders.prototype.maybeSetNormalizedName = function (name, lcName) {
518 if (!this.normalizedNames.has(lcName)) {
519 this.normalizedNames.set(lcName, name);
520 }
521 };
522 HttpHeaders.prototype.init = function () {
523 var _this = this;
524 if (!!this.lazyInit) {
525 if (this.lazyInit instanceof HttpHeaders) {
526 this.copyFrom(this.lazyInit);
527 }
528 else {
529 this.lazyInit();
530 }
531 this.lazyInit = null;
532 if (!!this.lazyUpdate) {
533 this.lazyUpdate.forEach(function (update) { return _this.applyUpdate(update); });
534 this.lazyUpdate = null;
535 }
536 }
537 };
538 HttpHeaders.prototype.copyFrom = function (other) {
539 var _this = this;
540 other.init();
541 Array.from(other.headers.keys()).forEach(function (key) {
542 _this.headers.set(key, other.headers.get(key));
543 _this.normalizedNames.set(key, other.normalizedNames.get(key));
544 });
545 };
546 HttpHeaders.prototype.clone = function (update) {
547 var clone = new HttpHeaders();
548 clone.lazyInit =
549 (!!this.lazyInit && this.lazyInit instanceof HttpHeaders) ? this.lazyInit : this;
550 clone.lazyUpdate = (this.lazyUpdate || []).concat([update]);
551 return clone;
552 };
553 HttpHeaders.prototype.applyUpdate = function (update) {
554 var key = update.name.toLowerCase();
555 switch (update.op) {
556 case 'a':
557 case 's':
558 var value = update.value;
559 if (typeof value === 'string') {
560 value = [value];
561 }
562 if (value.length === 0) {
563 return;
564 }
565 this.maybeSetNormalizedName(update.name, key);
566 var base = (update.op === 'a' ? this.headers.get(key) : undefined) || [];
567 base.push.apply(base, __spreadArray([], __read(value)));
568 this.headers.set(key, base);
569 break;
570 case 'd':
571 var toDelete_1 = update.value;
572 if (!toDelete_1) {
573 this.headers.delete(key);
574 this.normalizedNames.delete(key);
575 }
576 else {
577 var existing = this.headers.get(key);
578 if (!existing) {
579 return;
580 }
581 existing = existing.filter(function (value) { return toDelete_1.indexOf(value) === -1; });
582 if (existing.length === 0) {
583 this.headers.delete(key);
584 this.normalizedNames.delete(key);
585 }
586 else {
587 this.headers.set(key, existing);
588 }
589 }
590 break;
591 }
592 };
593 /**
594 * @internal
595 */
596 HttpHeaders.prototype.forEach = function (fn) {
597 var _this = this;
598 this.init();
599 Array.from(this.normalizedNames.keys())
600 .forEach(function (key) { return fn(_this.normalizedNames.get(key), _this.headers.get(key)); });
601 };
602 return HttpHeaders;
603 }());
604
605 /**
606 * @license
607 * Copyright Google LLC All Rights Reserved.
608 *
609 * Use of this source code is governed by an MIT-style license that can be
610 * found in the LICENSE file at https://angular.io/license
611 */
612 /**
613 * Provides encoding and decoding of URL parameter and query-string values.
614 *
615 * Serializes and parses URL parameter keys and values to encode and decode them.
616 * If you pass URL query parameters without encoding,
617 * the query parameters can be misinterpreted at the receiving end.
618 *
619 *
620 * @publicApi
621 */
622 var HttpUrlEncodingCodec = /** @class */ (function () {
623 function HttpUrlEncodingCodec() {
624 }
625 /**
626 * Encodes a key name for a URL parameter or query-string.
627 * @param key The key name.
628 * @returns The encoded key name.
629 */
630 HttpUrlEncodingCodec.prototype.encodeKey = function (key) {
631 return standardEncoding(key);
632 };
633 /**
634 * Encodes the value of a URL parameter or query-string.
635 * @param value The value.
636 * @returns The encoded value.
637 */
638 HttpUrlEncodingCodec.prototype.encodeValue = function (value) {
639 return standardEncoding(value);
640 };
641 /**
642 * Decodes an encoded URL parameter or query-string key.
643 * @param key The encoded key name.
644 * @returns The decoded key name.
645 */
646 HttpUrlEncodingCodec.prototype.decodeKey = function (key) {
647 return decodeURIComponent(key);
648 };
649 /**
650 * Decodes an encoded URL parameter or query-string value.
651 * @param value The encoded value.
652 * @returns The decoded value.
653 */
654 HttpUrlEncodingCodec.prototype.decodeValue = function (value) {
655 return decodeURIComponent(value);
656 };
657 return HttpUrlEncodingCodec;
658 }());
659 function paramParser(rawParams, codec) {
660 var map = new Map();
661 if (rawParams.length > 0) {
662 // The `window.location.search` can be used while creating an instance of the `HttpParams` class
663 // (e.g. `new HttpParams({ fromString: window.location.search })`). The `window.location.search`
664 // may start with the `?` char, so we strip it if it's present.
665 var params = rawParams.replace(/^\?/, '').split('&');
666 params.forEach(function (param) {
667 var eqIdx = param.indexOf('=');
668 var _b = __read(eqIdx == -1 ?
669 [codec.decodeKey(param), ''] :
670 [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))], 2), key = _b[0], val = _b[1];
671 var list = map.get(key) || [];
672 list.push(val);
673 map.set(key, list);
674 });
675 }
676 return map;
677 }
678 /**
679 * Encode input string with standard encodeURIComponent and then un-encode specific characters.
680 */
681 var STANDARD_ENCODING_REGEX = /%(\d[a-f0-9])/gi;
682 var STANDARD_ENCODING_REPLACEMENTS = {
683 '40': '@',
684 '3A': ':',
685 '24': '$',
686 '2C': ',',
687 '3B': ';',
688 '2B': '+',
689 '3D': '=',
690 '3F': '?',
691 '2F': '/',
692 };
693 function standardEncoding(v) {
694 return encodeURIComponent(v).replace(STANDARD_ENCODING_REGEX, function (s, t) { var _a; return (_a = STANDARD_ENCODING_REPLACEMENTS[t]) !== null && _a !== void 0 ? _a : s; });
695 }
696 function valueToString(value) {
697 return "" + value;
698 }
699 /**
700 * An HTTP request/response body that represents serialized parameters,
701 * per the MIME type `application/x-www-form-urlencoded`.
702 *
703 * This class is immutable; all mutation operations return a new instance.
704 *
705 * @publicApi
706 */
707 var HttpParams = /** @class */ (function () {
708 function HttpParams(options) {
709 var _this = this;
710 if (options === void 0) { options = {}; }
711 this.updates = null;
712 this.cloneFrom = null;
713 this.encoder = options.encoder || new HttpUrlEncodingCodec();
714 if (!!options.fromString) {
715 if (!!options.fromObject) {
716 throw new Error("Cannot specify both fromString and fromObject.");
717 }
718 this.map = paramParser(options.fromString, this.encoder);
719 }
720 else if (!!options.fromObject) {
721 this.map = new Map();
722 Object.keys(options.fromObject).forEach(function (key) {
723 var value = options.fromObject[key];
724 _this.map.set(key, Array.isArray(value) ? value : [value]);
725 });
726 }
727 else {
728 this.map = null;
729 }
730 }
731 /**
732 * Reports whether the body includes one or more values for a given parameter.
733 * @param param The parameter name.
734 * @returns True if the parameter has one or more values,
735 * false if it has no value or is not present.
736 */
737 HttpParams.prototype.has = function (param) {
738 this.init();
739 return this.map.has(param);
740 };
741 /**
742 * Retrieves the first value for a parameter.
743 * @param param The parameter name.
744 * @returns The first value of the given parameter,
745 * or `null` if the parameter is not present.
746 */
747 HttpParams.prototype.get = function (param) {
748 this.init();
749 var res = this.map.get(param);
750 return !!res ? res[0] : null;
751 };
752 /**
753 * Retrieves all values for a parameter.
754 * @param param The parameter name.
755 * @returns All values in a string array,
756 * or `null` if the parameter not present.
757 */
758 HttpParams.prototype.getAll = function (param) {
759 this.init();
760 return this.map.get(param) || null;
761 };
762 /**
763 * Retrieves all the parameters for this body.
764 * @returns The parameter names in a string array.
765 */
766 HttpParams.prototype.keys = function () {
767 this.init();
768 return Array.from(this.map.keys());
769 };
770 /**
771 * Appends a new value to existing values for a parameter.
772 * @param param The parameter name.
773 * @param value The new value to add.
774 * @return A new body with the appended value.
775 */
776 HttpParams.prototype.append = function (param, value) {
777 return this.clone({ param: param, value: value, op: 'a' });
778 };
779 /**
780 * Constructs a new body with appended values for the given parameter name.
781 * @param params parameters and values
782 * @return A new body with the new value.
783 */
784 HttpParams.prototype.appendAll = function (params) {
785 var updates = [];
786 Object.keys(params).forEach(function (param) {
787 var value = params[param];
788 if (Array.isArray(value)) {
789 value.forEach(function (_value) {
790 updates.push({ param: param, value: _value, op: 'a' });
791 });
792 }
793 else {
794 updates.push({ param: param, value: value, op: 'a' });
795 }
796 });
797 return this.clone(updates);
798 };
799 /**
800 * Replaces the value for a parameter.
801 * @param param The parameter name.
802 * @param value The new value.
803 * @return A new body with the new value.
804 */
805 HttpParams.prototype.set = function (param, value) {
806 return this.clone({ param: param, value: value, op: 's' });
807 };
808 /**
809 * Removes a given value or all values from a parameter.
810 * @param param The parameter name.
811 * @param value The value to remove, if provided.
812 * @return A new body with the given value removed, or with all values
813 * removed if no value is specified.
814 */
815 HttpParams.prototype.delete = function (param, value) {
816 return this.clone({ param: param, value: value, op: 'd' });
817 };
818 /**
819 * Serializes the body to an encoded string, where key-value pairs (separated by `=`) are
820 * separated by `&`s.
821 */
822 HttpParams.prototype.toString = function () {
823 var _this = this;
824 this.init();
825 return this.keys()
826 .map(function (key) {
827 var eKey = _this.encoder.encodeKey(key);
828 // `a: ['1']` produces `'a=1'`
829 // `b: []` produces `''`
830 // `c: ['1', '2']` produces `'c=1&c=2'`
831 return _this.map.get(key).map(function (value) { return eKey + '=' + _this.encoder.encodeValue(value); })
832 .join('&');
833 })
834 // filter out empty values because `b: []` produces `''`
835 // which results in `a=1&&c=1&c=2` instead of `a=1&c=1&c=2` if we don't
836 .filter(function (param) { return param !== ''; })
837 .join('&');
838 };
839 HttpParams.prototype.clone = function (update) {
840 var clone = new HttpParams({ encoder: this.encoder });
841 clone.cloneFrom = this.cloneFrom || this;
842 clone.updates = (this.updates || []).concat(update);
843 return clone;
844 };
845 HttpParams.prototype.init = function () {
846 var _this = this;
847 if (this.map === null) {
848 this.map = new Map();
849 }
850 if (this.cloneFrom !== null) {
851 this.cloneFrom.init();
852 this.cloneFrom.keys().forEach(function (key) { return _this.map.set(key, _this.cloneFrom.map.get(key)); });
853 this.updates.forEach(function (update) {
854 switch (update.op) {
855 case 'a':
856 case 's':
857 var base = (update.op === 'a' ? _this.map.get(update.param) : undefined) || [];
858 base.push(valueToString(update.value));
859 _this.map.set(update.param, base);
860 break;
861 case 'd':
862 if (update.value !== undefined) {
863 var base_1 = _this.map.get(update.param) || [];
864 var idx = base_1.indexOf(valueToString(update.value));
865 if (idx !== -1) {
866 base_1.splice(idx, 1);
867 }
868 if (base_1.length > 0) {
869 _this.map.set(update.param, base_1);
870 }
871 else {
872 _this.map.delete(update.param);
873 }
874 }
875 else {
876 _this.map.delete(update.param);
877 break;
878 }
879 }
880 });
881 this.cloneFrom = this.updates = null;
882 }
883 };
884 return HttpParams;
885 }());
886
887 /**
888 * @license
889 * Copyright Google LLC All Rights Reserved.
890 *
891 * Use of this source code is governed by an MIT-style license that can be
892 * found in the LICENSE file at https://angular.io/license
893 */
894 /**
895 * A token used to manipulate and access values stored in `HttpContext`.
896 *
897 * @publicApi
898 */
899 var HttpContextToken = /** @class */ (function () {
900 function HttpContextToken(defaultValue) {
901 this.defaultValue = defaultValue;
902 }
903 return HttpContextToken;
904 }());
905 /**
906 * Http context stores arbitrary user defined values and ensures type safety without
907 * actually knowing the types. It is backed by a `Map` and guarantees that keys do not clash.
908 *
909 * This context is mutable and is shared between cloned requests unless explicitly specified.
910 *
911 * @usageNotes
912 *
913 * ### Usage Example
914 *
915 * ```typescript
916 * // inside cache.interceptors.ts
917 * export const IS_CACHE_ENABLED = new HttpContextToken<boolean>(() => false);
918 *
919 * export class CacheInterceptor implements HttpInterceptor {
920 *
921 * intercept(req: HttpRequest<any>, delegate: HttpHandler): Observable<HttpEvent<any>> {
922 * if (req.context.get(IS_CACHE_ENABLED) === true) {
923 * return ...;
924 * }
925 * return delegate.handle(req);
926 * }
927 * }
928 *
929 * // inside a service
930 *
931 * this.httpClient.get('/api/weather', {
932 * context: new HttpContext().set(IS_CACHE_ENABLED, true)
933 * }).subscribe(...);
934 * ```
935 *
936 * @publicApi
937 */
938 var HttpContext = /** @class */ (function () {
939 function HttpContext() {
940 this.map = new Map();
941 }
942 /**
943 * Store a value in the context. If a value is already present it will be overwritten.
944 *
945 * @param token The reference to an instance of `HttpContextToken`.
946 * @param value The value to store.
947 *
948 * @returns A reference to itself for easy chaining.
949 */
950 HttpContext.prototype.set = function (token, value) {
951 this.map.set(token, value);
952 return this;
953 };
954 /**
955 * Retrieve the value associated with the given token.
956 *
957 * @param token The reference to an instance of `HttpContextToken`.
958 *
959 * @returns The stored value or default if one is defined.
960 */
961 HttpContext.prototype.get = function (token) {
962 if (!this.map.has(token)) {
963 this.map.set(token, token.defaultValue());
964 }
965 return this.map.get(token);
966 };
967 /**
968 * Delete the value associated with the given token.
969 *
970 * @param token The reference to an instance of `HttpContextToken`.
971 *
972 * @returns A reference to itself for easy chaining.
973 */
974 HttpContext.prototype.delete = function (token) {
975 this.map.delete(token);
976 return this;
977 };
978 /**
979 * @returns a list of tokens currently stored in the context.
980 */
981 HttpContext.prototype.keys = function () {
982 return this.map.keys();
983 };
984 return HttpContext;
985 }());
986
987 /**
988 * @license
989 * Copyright Google LLC All Rights Reserved.
990 *
991 * Use of this source code is governed by an MIT-style license that can be
992 * found in the LICENSE file at https://angular.io/license
993 */
994 /**
995 * Determine whether the given HTTP method may include a body.
996 */
997 function mightHaveBody(method) {
998 switch (method) {
999 case 'DELETE':
1000 case 'GET':
1001 case 'HEAD':
1002 case 'OPTIONS':
1003 case 'JSONP':
1004 return false;
1005 default:
1006 return true;
1007 }
1008 }
1009 /**
1010 * Safely assert whether the given value is an ArrayBuffer.
1011 *
1012 * In some execution environments ArrayBuffer is not defined.
1013 */
1014 function isArrayBuffer(value) {
1015 return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;
1016 }
1017 /**
1018 * Safely assert whether the given value is a Blob.
1019 *
1020 * In some execution environments Blob is not defined.
1021 */
1022 function isBlob(value) {
1023 return typeof Blob !== 'undefined' && value instanceof Blob;
1024 }
1025 /**
1026 * Safely assert whether the given value is a FormData instance.
1027 *
1028 * In some execution environments FormData is not defined.
1029 */
1030 function isFormData(value) {
1031 return typeof FormData !== 'undefined' && value instanceof FormData;
1032 }
1033 /**
1034 * Safely assert whether the given value is a URLSearchParams instance.
1035 *
1036 * In some execution environments URLSearchParams is not defined.
1037 */
1038 function isUrlSearchParams(value) {
1039 return typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams;
1040 }
1041 /**
1042 * An outgoing HTTP request with an optional typed body.
1043 *
1044 * `HttpRequest` represents an outgoing request, including URL, method,
1045 * headers, body, and other request configuration options. Instances should be
1046 * assumed to be immutable. To modify a `HttpRequest`, the `clone`
1047 * method should be used.
1048 *
1049 * @publicApi
1050 */
1051 var HttpRequest = /** @class */ (function () {
1052 function HttpRequest(method, url, third, fourth) {
1053 this.url = url;
1054 /**
1055 * The request body, or `null` if one isn't set.
1056 *
1057 * Bodies are not enforced to be immutable, as they can include a reference to any
1058 * user-defined data type. However, interceptors should take care to preserve
1059 * idempotence by treating them as such.
1060 */
1061 this.body = null;
1062 /**
1063 * Whether this request should be made in a way that exposes progress events.
1064 *
1065 * Progress events are expensive (change detection runs on each event) and so
1066 * they should only be requested if the consumer intends to monitor them.
1067 */
1068 this.reportProgress = false;
1069 /**
1070 * Whether this request should be sent with outgoing credentials (cookies).
1071 */
1072 this.withCredentials = false;
1073 /**
1074 * The expected response type of the server.
1075 *
1076 * This is used to parse the response appropriately before returning it to
1077 * the requestee.
1078 */
1079 this.responseType = 'json';
1080 this.method = method.toUpperCase();
1081 // Next, need to figure out which argument holds the HttpRequestInit
1082 // options, if any.
1083 var options;
1084 // Check whether a body argument is expected. The only valid way to omit
1085 // the body argument is to use a known no-body method like GET.
1086 if (mightHaveBody(this.method) || !!fourth) {
1087 // Body is the third argument, options are the fourth.
1088 this.body = (third !== undefined) ? third : null;
1089 options = fourth;
1090 }
1091 else {
1092 // No body required, options are the third argument. The body stays null.
1093 options = third;
1094 }
1095 // If options have been passed, interpret them.
1096 if (options) {
1097 // Normalize reportProgress and withCredentials.
1098 this.reportProgress = !!options.reportProgress;
1099 this.withCredentials = !!options.withCredentials;
1100 // Override default response type of 'json' if one is provided.
1101 if (!!options.responseType) {
1102 this.responseType = options.responseType;
1103 }
1104 // Override headers if they're provided.
1105 if (!!options.headers) {
1106 this.headers = options.headers;
1107 }
1108 if (!!options.context) {
1109 this.context = options.context;
1110 }
1111 if (!!options.params) {
1112 this.params = options.params;
1113 }
1114 }
1115 // If no headers have been passed in, construct a new HttpHeaders instance.
1116 if (!this.headers) {
1117 this.headers = new HttpHeaders();
1118 }
1119 // If no context have been passed in, construct a new HttpContext instance.
1120 if (!this.context) {
1121 this.context = new HttpContext();
1122 }
1123 // If no parameters have been passed in, construct a new HttpUrlEncodedParams instance.
1124 if (!this.params) {
1125 this.params = new HttpParams();
1126 this.urlWithParams = url;
1127 }
1128 else {
1129 // Encode the parameters to a string in preparation for inclusion in the URL.
1130 var params = this.params.toString();
1131 if (params.length === 0) {
1132 // No parameters, the visible URL is just the URL given at creation time.
1133 this.urlWithParams = url;
1134 }
1135 else {
1136 // Does the URL already have query parameters? Look for '?'.
1137 var qIdx = url.indexOf('?');
1138 // There are 3 cases to handle:
1139 // 1) No existing parameters -> append '?' followed by params.
1140 // 2) '?' exists and is followed by existing query string ->
1141 // append '&' followed by params.
1142 // 3) '?' exists at the end of the url -> append params directly.
1143 // This basically amounts to determining the character, if any, with
1144 // which to join the URL and parameters.
1145 var sep = qIdx === -1 ? '?' : (qIdx < url.length - 1 ? '&' : '');
1146 this.urlWithParams = url + sep + params;
1147 }
1148 }
1149 }
1150 /**
1151 * Transform the free-form body into a serialized format suitable for
1152 * transmission to the server.
1153 */
1154 HttpRequest.prototype.serializeBody = function () {
1155 // If no body is present, no need to serialize it.
1156 if (this.body === null) {
1157 return null;
1158 }
1159 // Check whether the body is already in a serialized form. If so,
1160 // it can just be returned directly.
1161 if (isArrayBuffer(this.body) || isBlob(this.body) || isFormData(this.body) ||
1162 isUrlSearchParams(this.body) || typeof this.body === 'string') {
1163 return this.body;
1164 }
1165 // Check whether the body is an instance of HttpUrlEncodedParams.
1166 if (this.body instanceof HttpParams) {
1167 return this.body.toString();
1168 }
1169 // Check whether the body is an object or array, and serialize with JSON if so.
1170 if (typeof this.body === 'object' || typeof this.body === 'boolean' ||
1171 Array.isArray(this.body)) {
1172 return JSON.stringify(this.body);
1173 }
1174 // Fall back on toString() for everything else.
1175 return this.body.toString();
1176 };
1177 /**
1178 * Examine the body and attempt to infer an appropriate MIME type
1179 * for it.
1180 *
1181 * If no such type can be inferred, this method will return `null`.
1182 */
1183 HttpRequest.prototype.detectContentTypeHeader = function () {
1184 // An empty body has no content type.
1185 if (this.body === null) {
1186 return null;
1187 }
1188 // FormData bodies rely on the browser's content type assignment.
1189 if (isFormData(this.body)) {
1190 return null;
1191 }
1192 // Blobs usually have their own content type. If it doesn't, then
1193 // no type can be inferred.
1194 if (isBlob(this.body)) {
1195 return this.body.type || null;
1196 }
1197 // Array buffers have unknown contents and thus no type can be inferred.
1198 if (isArrayBuffer(this.body)) {
1199 return null;
1200 }
1201 // Technically, strings could be a form of JSON data, but it's safe enough
1202 // to assume they're plain strings.
1203 if (typeof this.body === 'string') {
1204 return 'text/plain';
1205 }
1206 // `HttpUrlEncodedParams` has its own content-type.
1207 if (this.body instanceof HttpParams) {
1208 return 'application/x-www-form-urlencoded;charset=UTF-8';
1209 }
1210 // Arrays, objects, boolean and numbers will be encoded as JSON.
1211 if (typeof this.body === 'object' || typeof this.body === 'number' ||
1212 typeof this.body === 'boolean') {
1213 return 'application/json';
1214 }
1215 // No type could be inferred.
1216 return null;
1217 };
1218 HttpRequest.prototype.clone = function (update) {
1219 if (update === void 0) { update = {}; }
1220 var _a;
1221 // For method, url, and responseType, take the current value unless
1222 // it is overridden in the update hash.
1223 var method = update.method || this.method;
1224 var url = update.url || this.url;
1225 var responseType = update.responseType || this.responseType;
1226 // The body is somewhat special - a `null` value in update.body means
1227 // whatever current body is present is being overridden with an empty
1228 // body, whereas an `undefined` value in update.body implies no
1229 // override.
1230 var body = (update.body !== undefined) ? update.body : this.body;
1231 // Carefully handle the boolean options to differentiate between
1232 // `false` and `undefined` in the update args.
1233 var withCredentials = (update.withCredentials !== undefined) ? update.withCredentials : this.withCredentials;
1234 var reportProgress = (update.reportProgress !== undefined) ? update.reportProgress : this.reportProgress;
1235 // Headers and params may be appended to if `setHeaders` or
1236 // `setParams` are used.
1237 var headers = update.headers || this.headers;
1238 var params = update.params || this.params;
1239 // Pass on context if needed
1240 var context = (_a = update.context) !== null && _a !== void 0 ? _a : this.context;
1241 // Check whether the caller has asked to add headers.
1242 if (update.setHeaders !== undefined) {
1243 // Set every requested header.
1244 headers =
1245 Object.keys(update.setHeaders)
1246 .reduce(function (headers, name) { return headers.set(name, update.setHeaders[name]); }, headers);
1247 }
1248 // Check whether the caller has asked to set params.
1249 if (update.setParams) {
1250 // Set every requested param.
1251 params = Object.keys(update.setParams)
1252 .reduce(function (params, param) { return params.set(param, update.setParams[param]); }, params);
1253 }
1254 // Finally, construct the new HttpRequest using the pieces from above.
1255 return new HttpRequest(method, url, body, {
1256 params: params,
1257 headers: headers,
1258 context: context,
1259 reportProgress: reportProgress,
1260 responseType: responseType,
1261 withCredentials: withCredentials,
1262 });
1263 };
1264 return HttpRequest;
1265 }());
1266
1267 (function (HttpEventType) {
1268 /**
1269 * The request was sent out over the wire.
1270 */
1271 HttpEventType[HttpEventType["Sent"] = 0] = "Sent";
1272 /**
1273 * An upload progress event was received.
1274 */
1275 HttpEventType[HttpEventType["UploadProgress"] = 1] = "UploadProgress";
1276 /**
1277 * The response status code and headers were received.
1278 */
1279 HttpEventType[HttpEventType["ResponseHeader"] = 2] = "ResponseHeader";
1280 /**
1281 * A download progress event was received.
1282 */
1283 HttpEventType[HttpEventType["DownloadProgress"] = 3] = "DownloadProgress";
1284 /**
1285 * The full response including the body was received.
1286 */
1287 HttpEventType[HttpEventType["Response"] = 4] = "Response";
1288 /**
1289 * A custom event from an interceptor or a backend.
1290 */
1291 HttpEventType[HttpEventType["User"] = 5] = "User";
1292 })(exports.HttpEventType || (exports.HttpEventType = {}));
1293 /**
1294 * Base class for both `HttpResponse` and `HttpHeaderResponse`.
1295 *
1296 * @publicApi
1297 */
1298 var HttpResponseBase = /** @class */ (function () {
1299 /**
1300 * Super-constructor for all responses.
1301 *
1302 * The single parameter accepted is an initialization hash. Any properties
1303 * of the response passed there will override the default values.
1304 */
1305 function HttpResponseBase(init, defaultStatus /* Ok */, defaultStatusText) {
1306 if (defaultStatus === void 0) { defaultStatus = 200; }
1307 if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }
1308 // If the hash has values passed, use them to initialize the response.
1309 // Otherwise use the default values.
1310 this.headers = init.headers || new HttpHeaders();
1311 this.status = init.status !== undefined ? init.status : defaultStatus;
1312 this.statusText = init.statusText || defaultStatusText;
1313 this.url = init.url || null;
1314 // Cache the ok value to avoid defining a getter.
1315 this.ok = this.status >= 200 && this.status < 300;
1316 }
1317 return HttpResponseBase;
1318 }());
1319 /**
1320 * A partial HTTP response which only includes the status and header data,
1321 * but no response body.
1322 *
1323 * `HttpHeaderResponse` is a `HttpEvent` available on the response
1324 * event stream, only when progress events are requested.
1325 *
1326 * @publicApi
1327 */
1328 var HttpHeaderResponse = /** @class */ (function (_super) {
1329 __extends(HttpHeaderResponse, _super);
1330 /**
1331 * Create a new `HttpHeaderResponse` with the given parameters.
1332 */
1333 function HttpHeaderResponse(init) {
1334 if (init === void 0) { init = {}; }
1335 var _this = _super.call(this, init) || this;
1336 _this.type = exports.HttpEventType.ResponseHeader;
1337 return _this;
1338 }
1339 /**
1340 * Copy this `HttpHeaderResponse`, overriding its contents with the
1341 * given parameter hash.
1342 */
1343 HttpHeaderResponse.prototype.clone = function (update) {
1344 if (update === void 0) { update = {}; }
1345 // Perform a straightforward initialization of the new HttpHeaderResponse,
1346 // overriding the current parameters with new ones if given.
1347 return new HttpHeaderResponse({
1348 headers: update.headers || this.headers,
1349 status: update.status !== undefined ? update.status : this.status,
1350 statusText: update.statusText || this.statusText,
1351 url: update.url || this.url || undefined,
1352 });
1353 };
1354 return HttpHeaderResponse;
1355 }(HttpResponseBase));
1356 /**
1357 * A full HTTP response, including a typed response body (which may be `null`
1358 * if one was not returned).
1359 *
1360 * `HttpResponse` is a `HttpEvent` available on the response event
1361 * stream.
1362 *
1363 * @publicApi
1364 */
1365 var HttpResponse = /** @class */ (function (_super) {
1366 __extends(HttpResponse, _super);
1367 /**
1368 * Construct a new `HttpResponse`.
1369 */
1370 function HttpResponse(init) {
1371 if (init === void 0) { init = {}; }
1372 var _this = _super.call(this, init) || this;
1373 _this.type = exports.HttpEventType.Response;
1374 _this.body = init.body !== undefined ? init.body : null;
1375 return _this;
1376 }
1377 HttpResponse.prototype.clone = function (update) {
1378 if (update === void 0) { update = {}; }
1379 return new HttpResponse({
1380 body: (update.body !== undefined) ? update.body : this.body,
1381 headers: update.headers || this.headers,
1382 status: (update.status !== undefined) ? update.status : this.status,
1383 statusText: update.statusText || this.statusText,
1384 url: update.url || this.url || undefined,
1385 });
1386 };
1387 return HttpResponse;
1388 }(HttpResponseBase));
1389 /**
1390 * A response that represents an error or failure, either from a
1391 * non-successful HTTP status, an error while executing the request,
1392 * or some other failure which occurred during the parsing of the response.
1393 *
1394 * Any error returned on the `Observable` response stream will be
1395 * wrapped in an `HttpErrorResponse` to provide additional context about
1396 * the state of the HTTP layer when the error occurred. The error property
1397 * will contain either a wrapped Error object or the error response returned
1398 * from the server.
1399 *
1400 * @publicApi
1401 */
1402 var HttpErrorResponse = /** @class */ (function (_super) {
1403 __extends(HttpErrorResponse, _super);
1404 function HttpErrorResponse(init) {
1405 var _this =
1406 // Initialize with a default status of 0 / Unknown Error.
1407 _super.call(this, init, 0, 'Unknown Error') || this;
1408 _this.name = 'HttpErrorResponse';
1409 /**
1410 * Errors are never okay, even when the status code is in the 2xx success range.
1411 */
1412 _this.ok = false;
1413 // If the response was successful, then this was a parse error. Otherwise, it was
1414 // a protocol-level failure of some sort. Either the request failed in transit
1415 // or the server returned an unsuccessful status code.
1416 if (_this.status >= 200 && _this.status < 300) {
1417 _this.message = "Http failure during parsing for " + (init.url || '(unknown url)');
1418 }
1419 else {
1420 _this.message = "Http failure response for " + (init.url || '(unknown url)') + ": " + init.status + " " + init.statusText;
1421 }
1422 _this.error = init.error || null;
1423 return _this;
1424 }
1425 return HttpErrorResponse;
1426 }(HttpResponseBase));
1427
1428 /**
1429 * @license
1430 * Copyright Google LLC All Rights Reserved.
1431 *
1432 * Use of this source code is governed by an MIT-style license that can be
1433 * found in the LICENSE file at https://angular.io/license
1434 */
1435 /**
1436 * Constructs an instance of `HttpRequestOptions<T>` from a source `HttpMethodOptions` and
1437 * the given `body`. This function clones the object and adds the body.
1438 *
1439 * Note that the `responseType` *options* value is a String that identifies the
1440 * single data type of the response.
1441 * A single overload version of the method handles each response type.
1442 * The value of `responseType` cannot be a union, as the combined signature could imply.
1443 *
1444 */
1445 function addBody(options, body) {
1446 return {
1447 body: body,
1448 headers: options.headers,
1449 context: options.context,
1450 observe: options.observe,
1451 params: options.params,
1452 reportProgress: options.reportProgress,
1453 responseType: options.responseType,
1454 withCredentials: options.withCredentials,
1455 };
1456 }
1457 /**
1458 * Performs HTTP requests.
1459 * This service is available as an injectable class, with methods to perform HTTP requests.
1460 * Each request method has multiple signatures, and the return type varies based on
1461 * the signature that is called (mainly the values of `observe` and `responseType`).
1462 *
1463 * Note that the `responseType` *options* value is a String that identifies the
1464 * single data type of the response.
1465 * A single overload version of the method handles each response type.
1466 * The value of `responseType` cannot be a union, as the combined signature could imply.
1467
1468 *
1469 * @usageNotes
1470 * Sample HTTP requests for the [Tour of Heroes](/tutorial/toh-pt0) application.
1471 *
1472 * ### HTTP Request Example
1473 *
1474 * ```
1475 * // GET heroes whose name contains search term
1476 * searchHeroes(term: string): observable<Hero[]>{
1477 *
1478 * const params = new HttpParams({fromString: 'name=term'});
1479 * return this.httpClient.request('GET', this.heroesUrl, {responseType:'json', params});
1480 * }
1481 * ```
1482 *
1483 * Alternatively, the parameter string can be used without invoking HttpParams
1484 * by directly joining to the URL.
1485 * ```
1486 * this.httpClient.request('GET', this.heroesUrl + '?' + 'name=term', {responseType:'json'});
1487 * ```
1488 *
1489 *
1490 * ### JSONP Example
1491 * ```
1492 * requestJsonp(url, callback = 'callback') {
1493 * return this.httpClient.jsonp(this.heroesURL, callback);
1494 * }
1495 * ```
1496 *
1497 * ### PATCH Example
1498 * ```
1499 * // PATCH one of the heroes' name
1500 * patchHero (id: number, heroName: string): Observable<{}> {
1501 * const url = `${this.heroesUrl}/${id}`; // PATCH api/heroes/42
1502 * return this.httpClient.patch(url, {name: heroName}, httpOptions)
1503 * .pipe(catchError(this.handleError('patchHero')));
1504 * }
1505 * ```
1506 *
1507 * @see [HTTP Guide](guide/http)
1508 * @see [HTTP Request](api/common/http/HttpRequest)
1509 *
1510 * @publicApi
1511 */
1512 var HttpClient = /** @class */ (function () {
1513 function HttpClient(handler) {
1514 this.handler = handler;
1515 }
1516 /**
1517 * Constructs an observable for a generic HTTP request that, when subscribed,
1518 * fires the request through the chain of registered interceptors and on to the
1519 * server.
1520 *
1521 * You can pass an `HttpRequest` directly as the only parameter. In this case,
1522 * the call returns an observable of the raw `HttpEvent` stream.
1523 *
1524 * Alternatively you can pass an HTTP method as the first parameter,
1525 * a URL string as the second, and an options hash containing the request body as the third.
1526 * See `addBody()`. In this case, the specified `responseType` and `observe` options determine the
1527 * type of returned observable.
1528 * * The `responseType` value determines how a successful response body is parsed.
1529 * * If `responseType` is the default `json`, you can pass a type interface for the resulting
1530 * object as a type parameter to the call.
1531 *
1532 * The `observe` value determines the return type, according to what you are interested in
1533 * observing.
1534 * * An `observe` value of events returns an observable of the raw `HttpEvent` stream, including
1535 * progress events by default.
1536 * * An `observe` value of response returns an observable of `HttpResponse<T>`,
1537 * where the `T` parameter depends on the `responseType` and any optionally provided type
1538 * parameter.
1539 * * An `observe` value of body returns an observable of `<T>` with the same `T` body type.
1540 *
1541 */
1542 HttpClient.prototype.request = function (first, url, options) {
1543 var _this = this;
1544 if (options === void 0) { options = {}; }
1545 var req;
1546 // First, check whether the primary argument is an instance of `HttpRequest`.
1547 if (first instanceof HttpRequest) {
1548 // It is. The other arguments must be undefined (per the signatures) and can be
1549 // ignored.
1550 req = first;
1551 }
1552 else {
1553 // It's a string, so it represents a URL. Construct a request based on it,
1554 // and incorporate the remaining arguments (assuming `GET` unless a method is
1555 // provided.
1556 // Figure out the headers.
1557 var headers = undefined;
1558 if (options.headers instanceof HttpHeaders) {
1559 headers = options.headers;
1560 }
1561 else {
1562 headers = new HttpHeaders(options.headers);
1563 }
1564 // Sort out parameters.
1565 var params = undefined;
1566 if (!!options.params) {
1567 if (options.params instanceof HttpParams) {
1568 params = options.params;
1569 }
1570 else {
1571 params = new HttpParams({ fromObject: options.params });
1572 }
1573 }
1574 // Construct the request.
1575 req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), {
1576 headers: headers,
1577 context: options.context,
1578 params: params,
1579 reportProgress: options.reportProgress,
1580 // By default, JSON is assumed to be returned for all calls.
1581 responseType: options.responseType || 'json',
1582 withCredentials: options.withCredentials,
1583 });
1584 }
1585 // Start with an Observable.of() the initial request, and run the handler (which
1586 // includes all interceptors) inside a concatMap(). This way, the handler runs
1587 // inside an Observable chain, which causes interceptors to be re-run on every
1588 // subscription (this also makes retries re-run the handler, including interceptors).
1589 var events$ = rxjs.of(req).pipe(operators.concatMap(function (req) { return _this.handler.handle(req); }));
1590 // If coming via the API signature which accepts a previously constructed HttpRequest,
1591 // the only option is to get the event stream. Otherwise, return the event stream if
1592 // that is what was requested.
1593 if (first instanceof HttpRequest || options.observe === 'events') {
1594 return events$;
1595 }
1596 // The requested stream contains either the full response or the body. In either
1597 // case, the first step is to filter the event stream to extract a stream of
1598 // responses(s).
1599 var res$ = events$.pipe(operators.filter(function (event) { return event instanceof HttpResponse; }));
1600 // Decide which stream to return.
1601 switch (options.observe || 'body') {
1602 case 'body':
1603 // The requested stream is the body. Map the response stream to the response
1604 // body. This could be done more simply, but a misbehaving interceptor might
1605 // transform the response body into a different format and ignore the requested
1606 // responseType. Guard against this by validating that the response is of the
1607 // requested type.
1608 switch (req.responseType) {
1609 case 'arraybuffer':
1610 return res$.pipe(operators.map(function (res) {
1611 // Validate that the body is an ArrayBuffer.
1612 if (res.body !== null && !(res.body instanceof ArrayBuffer)) {
1613 throw new Error('Response is not an ArrayBuffer.');
1614 }
1615 return res.body;
1616 }));
1617 case 'blob':
1618 return res$.pipe(operators.map(function (res) {
1619 // Validate that the body is a Blob.
1620 if (res.body !== null && !(res.body instanceof Blob)) {
1621 throw new Error('Response is not a Blob.');
1622 }
1623 return res.body;
1624 }));
1625 case 'text':
1626 return res$.pipe(operators.map(function (res) {
1627 // Validate that the body is a string.
1628 if (res.body !== null && typeof res.body !== 'string') {
1629 throw new Error('Response is not a string.');
1630 }
1631 return res.body;
1632 }));
1633 case 'json':
1634 default:
1635 // No validation needed for JSON responses, as they can be of any type.
1636 return res$.pipe(operators.map(function (res) { return res.body; }));
1637 }
1638 case 'response':
1639 // The response stream was requested directly, so return it.
1640 return res$;
1641 default:
1642 // Guard against new future observe types being added.
1643 throw new Error("Unreachable: unhandled observe type " + options.observe + "}");
1644 }
1645 };
1646 /**
1647 * Constructs an observable that, when subscribed, causes the configured
1648 * `DELETE` request to execute on the server. See the individual overloads for
1649 * details on the return type.
1650 *
1651 * @param url The endpoint URL.
1652 * @param options The HTTP options to send with the request.
1653 *
1654 */
1655 HttpClient.prototype.delete = function (url, options) {
1656 if (options === void 0) { options = {}; }
1657 return this.request('DELETE', url, options);
1658 };
1659 /**
1660 * Constructs an observable that, when subscribed, causes the configured
1661 * `GET` request to execute on the server. See the individual overloads for
1662 * details on the return type.
1663 */
1664 HttpClient.prototype.get = function (url, options) {
1665 if (options === void 0) { options = {}; }
1666 return this.request('GET', url, options);
1667 };
1668 /**
1669 * Constructs an observable that, when subscribed, causes the configured
1670 * `HEAD` request to execute on the server. The `HEAD` method returns
1671 * meta information about the resource without transferring the
1672 * resource itself. See the individual overloads for
1673 * details on the return type.
1674 */
1675 HttpClient.prototype.head = function (url, options) {
1676 if (options === void 0) { options = {}; }
1677 return this.request('HEAD', url, options);
1678 };
1679 /**
1680 * Constructs an `Observable` that, when subscribed, causes a request with the special method
1681 * `JSONP` to be dispatched via the interceptor pipeline.
1682 * The [JSONP pattern](https://en.wikipedia.org/wiki/JSONP) works around limitations of certain
1683 * API endpoints that don't support newer,
1684 * and preferable [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) protocol.
1685 * JSONP treats the endpoint API as a JavaScript file and tricks the browser to process the
1686 * requests even if the API endpoint is not located on the same domain (origin) as the client-side
1687 * application making the request.
1688 * The endpoint API must support JSONP callback for JSONP requests to work.
1689 * The resource API returns the JSON response wrapped in a callback function.
1690 * You can pass the callback function name as one of the query parameters.
1691 * Note that JSONP requests can only be used with `GET` requests.
1692 *
1693 * @param url The resource URL.
1694 * @param callbackParam The callback function name.
1695 *
1696 */
1697 HttpClient.prototype.jsonp = function (url, callbackParam) {
1698 return this.request('JSONP', url, {
1699 params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'),
1700 observe: 'body',
1701 responseType: 'json',
1702 });
1703 };
1704 /**
1705 * Constructs an `Observable` that, when subscribed, causes the configured
1706 * `OPTIONS` request to execute on the server. This method allows the client
1707 * to determine the supported HTTP methods and other capabilities of an endpoint,
1708 * without implying a resource action. See the individual overloads for
1709 * details on the return type.
1710 */
1711 HttpClient.prototype.options = function (url, options) {
1712 if (options === void 0) { options = {}; }
1713 return this.request('OPTIONS', url, options);
1714 };
1715 /**
1716 * Constructs an observable that, when subscribed, causes the configured
1717 * `PATCH` request to execute on the server. See the individual overloads for
1718 * details on the return type.
1719 */
1720 HttpClient.prototype.patch = function (url, body, options) {
1721 if (options === void 0) { options = {}; }
1722 return this.request('PATCH', url, addBody(options, body));
1723 };
1724 /**
1725 * Constructs an observable that, when subscribed, causes the configured
1726 * `POST` request to execute on the server. The server responds with the location of
1727 * the replaced resource. See the individual overloads for
1728 * details on the return type.
1729 */
1730 HttpClient.prototype.post = function (url, body, options) {
1731 if (options === void 0) { options = {}; }
1732 return this.request('POST', url, addBody(options, body));
1733 };
1734 /**
1735 * Constructs an observable that, when subscribed, causes the configured
1736 * `PUT` request to execute on the server. The `PUT` method replaces an existing resource
1737 * with a new set of values.
1738 * See the individual overloads for details on the return type.
1739 */
1740 HttpClient.prototype.put = function (url, body, options) {
1741 if (options === void 0) { options = {}; }
1742 return this.request('PUT', url, addBody(options, body));
1743 };
1744 return HttpClient;
1745 }());
1746 HttpClient.decorators = [
1747 { type: core.Injectable }
1748 ];
1749 HttpClient.ctorParameters = function () { return [
1750 { type: HttpHandler }
1751 ]; };
1752
1753 /**
1754 * @license
1755 * Copyright Google LLC All Rights Reserved.
1756 *
1757 * Use of this source code is governed by an MIT-style license that can be
1758 * found in the LICENSE file at https://angular.io/license
1759 */
1760 /**
1761 * `HttpHandler` which applies an `HttpInterceptor` to an `HttpRequest`.
1762 *
1763 *
1764 */
1765 var HttpInterceptorHandler = /** @class */ (function () {
1766 function HttpInterceptorHandler(next, interceptor) {
1767 this.next = next;
1768 this.interceptor = interceptor;
1769 }
1770 HttpInterceptorHandler.prototype.handle = function (req) {
1771 return this.interceptor.intercept(req, this.next);
1772 };
1773 return HttpInterceptorHandler;
1774 }());
1775 /**
1776 * A multi-provider token that represents the array of registered
1777 * `HttpInterceptor` objects.
1778 *
1779 * @publicApi
1780 */
1781 var HTTP_INTERCEPTORS = new core.InjectionToken('HTTP_INTERCEPTORS');
1782 var NoopInterceptor = /** @class */ (function () {
1783 function NoopInterceptor() {
1784 }
1785 NoopInterceptor.prototype.intercept = function (req, next) {
1786 return next.handle(req);
1787 };
1788 return NoopInterceptor;
1789 }());
1790 NoopInterceptor.decorators = [
1791 { type: core.Injectable }
1792 ];
1793
1794 /**
1795 * @license
1796 * Copyright Google LLC All Rights Reserved.
1797 *
1798 * Use of this source code is governed by an MIT-style license that can be
1799 * found in the LICENSE file at https://angular.io/license
1800 */
1801 // Every request made through JSONP needs a callback name that's unique across the
1802 // whole page. Each request is assigned an id and the callback name is constructed
1803 // from that. The next id to be assigned is tracked in a global variable here that
1804 // is shared among all applications on the page.
1805 var nextRequestId = 0;
1806 // Error text given when a JSONP script is injected, but doesn't invoke the callback
1807 // passed in its URL.
1808 var JSONP_ERR_NO_CALLBACK = 'JSONP injected script did not invoke callback.';
1809 // Error text given when a request is passed to the JsonpClientBackend that doesn't
1810 // have a request method JSONP.
1811 var JSONP_ERR_WRONG_METHOD = 'JSONP requests must use JSONP request method.';
1812 var JSONP_ERR_WRONG_RESPONSE_TYPE = 'JSONP requests must use Json response type.';
1813 /**
1814 * DI token/abstract type representing a map of JSONP callbacks.
1815 *
1816 * In the browser, this should always be the `window` object.
1817 *
1818 *
1819 */
1820 var JsonpCallbackContext = /** @class */ (function () {
1821 function JsonpCallbackContext() {
1822 }
1823 return JsonpCallbackContext;
1824 }());
1825 /**
1826 * Processes an `HttpRequest` with the JSONP method,
1827 * by performing JSONP style requests.
1828 * @see `HttpHandler`
1829 * @see `HttpXhrBackend`
1830 *
1831 * @publicApi
1832 */
1833 var JsonpClientBackend = /** @class */ (function () {
1834 function JsonpClientBackend(callbackMap, document) {
1835 this.callbackMap = callbackMap;
1836 this.document = document;
1837 /**
1838 * A resolved promise that can be used to schedule microtasks in the event handlers.
1839 */
1840 this.resolvedPromise = Promise.resolve();
1841 }
1842 /**
1843 * Get the name of the next callback method, by incrementing the global `nextRequestId`.
1844 */
1845 JsonpClientBackend.prototype.nextCallback = function () {
1846 return "ng_jsonp_callback_" + nextRequestId++;
1847 };
1848 /**
1849 * Processes a JSONP request and returns an event stream of the results.
1850 * @param req The request object.
1851 * @returns An observable of the response events.
1852 *
1853 */
1854 JsonpClientBackend.prototype.handle = function (req) {
1855 var _this = this;
1856 // Firstly, check both the method and response type. If either doesn't match
1857 // then the request was improperly routed here and cannot be handled.
1858 if (req.method !== 'JSONP') {
1859 throw new Error(JSONP_ERR_WRONG_METHOD);
1860 }
1861 else if (req.responseType !== 'json') {
1862 throw new Error(JSONP_ERR_WRONG_RESPONSE_TYPE);
1863 }
1864 // Everything else happens inside the Observable boundary.
1865 return new rxjs.Observable(function (observer) {
1866 // The first step to make a request is to generate the callback name, and replace the
1867 // callback placeholder in the URL with the name. Care has to be taken here to ensure
1868 // a trailing &, if matched, gets inserted back into the URL in the correct place.
1869 var callback = _this.nextCallback();
1870 var url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, "=" + callback + "$1");
1871 // Construct the <script> tag and point it at the URL.
1872 var node = _this.document.createElement('script');
1873 node.src = url;
1874 // A JSONP request requires waiting for multiple callbacks. These variables
1875 // are closed over and track state across those callbacks.
1876 // The response object, if one has been received, or null otherwise.
1877 var body = null;
1878 // Whether the response callback has been called.
1879 var finished = false;
1880 // Whether the request has been cancelled (and thus any other callbacks)
1881 // should be ignored.
1882 var cancelled = false;
1883 // Set the response callback in this.callbackMap (which will be the window
1884 // object in the browser. The script being loaded via the <script> tag will
1885 // eventually call this callback.
1886 _this.callbackMap[callback] = function (data) {
1887 // Data has been received from the JSONP script. Firstly, delete this callback.
1888 delete _this.callbackMap[callback];
1889 // Next, make sure the request wasn't cancelled in the meantime.
1890 if (cancelled) {
1891 return;
1892 }
1893 // Set state to indicate data was received.
1894 body = data;
1895 finished = true;
1896 };
1897 // cleanup() is a utility closure that removes the <script> from the page and
1898 // the response callback from the window. This logic is used in both the
1899 // success, error, and cancellation paths, so it's extracted out for convenience.
1900 var cleanup = function () {
1901 // Remove the <script> tag if it's still on the page.
1902 if (node.parentNode) {
1903 node.parentNode.removeChild(node);
1904 }
1905 // Remove the response callback from the callbackMap (window object in the
1906 // browser).
1907 delete _this.callbackMap[callback];
1908 };
1909 // onLoad() is the success callback which runs after the response callback
1910 // if the JSONP script loads successfully. The event itself is unimportant.
1911 // If something went wrong, onLoad() may run without the response callback
1912 // having been invoked.
1913 var onLoad = function (event) {
1914 // Do nothing if the request has been cancelled.
1915 if (cancelled) {
1916 return;
1917 }
1918 // We wrap it in an extra Promise, to ensure the microtask
1919 // is scheduled after the loaded endpoint has executed any potential microtask itself,
1920 // which is not guaranteed in Internet Explorer and EdgeHTML. See issue #39496
1921 _this.resolvedPromise.then(function () {
1922 // Cleanup the page.
1923 cleanup();
1924 // Check whether the response callback has run.
1925 if (!finished) {
1926 // It hasn't, something went wrong with the request. Return an error via
1927 // the Observable error path. All JSONP errors have status 0.
1928 observer.error(new HttpErrorResponse({
1929 url: url,
1930 status: 0,
1931 statusText: 'JSONP Error',
1932 error: new Error(JSONP_ERR_NO_CALLBACK),
1933 }));
1934 return;
1935 }
1936 // Success. body either contains the response body or null if none was
1937 // returned.
1938 observer.next(new HttpResponse({
1939 body: body,
1940 status: 200 /* Ok */,
1941 statusText: 'OK',
1942 url: url,
1943 }));
1944 // Complete the stream, the response is over.
1945 observer.complete();
1946 });
1947 };
1948 // onError() is the error callback, which runs if the script returned generates
1949 // a Javascript error. It emits the error via the Observable error channel as
1950 // a HttpErrorResponse.
1951 var onError = function (error) {
1952 // If the request was already cancelled, no need to emit anything.
1953 if (cancelled) {
1954 return;
1955 }
1956 cleanup();
1957 // Wrap the error in a HttpErrorResponse.
1958 observer.error(new HttpErrorResponse({
1959 error: error,
1960 status: 0,
1961 statusText: 'JSONP Error',
1962 url: url,
1963 }));
1964 };
1965 // Subscribe to both the success (load) and error events on the <script> tag,
1966 // and add it to the page.
1967 node.addEventListener('load', onLoad);
1968 node.addEventListener('error', onError);
1969 _this.document.body.appendChild(node);
1970 // The request has now been successfully sent.
1971 observer.next({ type: exports.HttpEventType.Sent });
1972 // Cancellation handler.
1973 return function () {
1974 // Track the cancellation so event listeners won't do anything even if already scheduled.
1975 cancelled = true;
1976 // Remove the event listeners so they won't run if the events later fire.
1977 node.removeEventListener('load', onLoad);
1978 node.removeEventListener('error', onError);
1979 // And finally, clean up the page.
1980 cleanup();
1981 };
1982 });
1983 };
1984 return JsonpClientBackend;
1985 }());
1986 JsonpClientBackend.decorators = [
1987 { type: core.Injectable }
1988 ];
1989 JsonpClientBackend.ctorParameters = function () { return [
1990 { type: JsonpCallbackContext },
1991 { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
1992 ]; };
1993 /**
1994 * Identifies requests with the method JSONP and
1995 * shifts them to the `JsonpClientBackend`.
1996 *
1997 * @see `HttpInterceptor`
1998 *
1999 * @publicApi
2000 */
2001 var JsonpInterceptor = /** @class */ (function () {
2002 function JsonpInterceptor(jsonp) {
2003 this.jsonp = jsonp;
2004 }
2005 /**
2006 * Identifies and handles a given JSONP request.
2007 * @param req The outgoing request object to handle.
2008 * @param next The next interceptor in the chain, or the backend
2009 * if no interceptors remain in the chain.
2010 * @returns An observable of the event stream.
2011 */
2012 JsonpInterceptor.prototype.intercept = function (req, next) {
2013 if (req.method === 'JSONP') {
2014 return this.jsonp.handle(req);
2015 }
2016 // Fall through for normal HTTP requests.
2017 return next.handle(req);
2018 };
2019 return JsonpInterceptor;
2020 }());
2021 JsonpInterceptor.decorators = [
2022 { type: core.Injectable }
2023 ];
2024 JsonpInterceptor.ctorParameters = function () { return [
2025 { type: JsonpClientBackend }
2026 ]; };
2027
2028 /**
2029 * @license
2030 * Copyright Google LLC All Rights Reserved.
2031 *
2032 * Use of this source code is governed by an MIT-style license that can be
2033 * found in the LICENSE file at https://angular.io/license
2034 */
2035 var XSSI_PREFIX = /^\)\]\}',?\n/;
2036 /**
2037 * Determine an appropriate URL for the response, by checking either
2038 * XMLHttpRequest.responseURL or the X-Request-URL header.
2039 */
2040 function getResponseUrl(xhr) {
2041 if ('responseURL' in xhr && xhr.responseURL) {
2042 return xhr.responseURL;
2043 }
2044 if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
2045 return xhr.getResponseHeader('X-Request-URL');
2046 }
2047 return null;
2048 }
2049 /**
2050 * Uses `XMLHttpRequest` to send requests to a backend server.
2051 * @see `HttpHandler`
2052 * @see `JsonpClientBackend`
2053 *
2054 * @publicApi
2055 */
2056 var HttpXhrBackend = /** @class */ (function () {
2057 function HttpXhrBackend(xhrFactory) {
2058 this.xhrFactory = xhrFactory;
2059 }
2060 /**
2061 * Processes a request and returns a stream of response events.
2062 * @param req The request object.
2063 * @returns An observable of the response events.
2064 */
2065 HttpXhrBackend.prototype.handle = function (req) {
2066 var _this = this;
2067 // Quick check to give a better error message when a user attempts to use
2068 // HttpClient.jsonp() without installing the HttpClientJsonpModule
2069 if (req.method === 'JSONP') {
2070 throw new Error("Attempted to construct Jsonp request without HttpClientJsonpModule installed.");
2071 }
2072 // Everything happens on Observable subscription.
2073 return new rxjs.Observable(function (observer) {
2074 // Start by setting up the XHR object with request method, URL, and withCredentials flag.
2075 var xhr = _this.xhrFactory.build();
2076 xhr.open(req.method, req.urlWithParams);
2077 if (!!req.withCredentials) {
2078 xhr.withCredentials = true;
2079 }
2080 // Add all the requested headers.
2081 req.headers.forEach(function (name, values) { return xhr.setRequestHeader(name, values.join(',')); });
2082 // Add an Accept header if one isn't present already.
2083 if (!req.headers.has('Accept')) {
2084 xhr.setRequestHeader('Accept', 'application/json, text/plain, */*');
2085 }
2086 // Auto-detect the Content-Type header if one isn't present already.
2087 if (!req.headers.has('Content-Type')) {
2088 var detectedType = req.detectContentTypeHeader();
2089 // Sometimes Content-Type detection fails.
2090 if (detectedType !== null) {
2091 xhr.setRequestHeader('Content-Type', detectedType);
2092 }
2093 }
2094 // Set the responseType if one was requested.
2095 if (req.responseType) {
2096 var responseType = req.responseType.toLowerCase();
2097 // JSON responses need to be processed as text. This is because if the server
2098 // returns an XSSI-prefixed JSON response, the browser will fail to parse it,
2099 // xhr.response will be null, and xhr.responseText cannot be accessed to
2100 // retrieve the prefixed JSON data in order to strip the prefix. Thus, all JSON
2101 // is parsed by first requesting text and then applying JSON.parse.
2102 xhr.responseType = ((responseType !== 'json') ? responseType : 'text');
2103 }
2104 // Serialize the request body if one is present. If not, this will be set to null.
2105 var reqBody = req.serializeBody();
2106 // If progress events are enabled, response headers will be delivered
2107 // in two events - the HttpHeaderResponse event and the full HttpResponse
2108 // event. However, since response headers don't change in between these
2109 // two events, it doesn't make sense to parse them twice. So headerResponse
2110 // caches the data extracted from the response whenever it's first parsed,
2111 // to ensure parsing isn't duplicated.
2112 var headerResponse = null;
2113 // partialFromXhr extracts the HttpHeaderResponse from the current XMLHttpRequest
2114 // state, and memoizes it into headerResponse.
2115 var partialFromXhr = function () {
2116 if (headerResponse !== null) {
2117 return headerResponse;
2118 }
2119 // Read status and normalize an IE9 bug (https://bugs.jquery.com/ticket/1450).
2120 var status = xhr.status === 1223 ? 204 /* NoContent */ : xhr.status;
2121 var statusText = xhr.statusText || 'OK';
2122 // Parse headers from XMLHttpRequest - this step is lazy.
2123 var headers = new HttpHeaders(xhr.getAllResponseHeaders());
2124 // Read the response URL from the XMLHttpResponse instance and fall back on the
2125 // request URL.
2126 var url = getResponseUrl(xhr) || req.url;
2127 // Construct the HttpHeaderResponse and memoize it.
2128 headerResponse = new HttpHeaderResponse({ headers: headers, status: status, statusText: statusText, url: url });
2129 return headerResponse;
2130 };
2131 // Next, a few closures are defined for the various events which XMLHttpRequest can
2132 // emit. This allows them to be unregistered as event listeners later.
2133 // First up is the load event, which represents a response being fully available.
2134 var onLoad = function () {
2135 // Read response state from the memoized partial data.
2136 var _a = partialFromXhr(), headers = _a.headers, status = _a.status, statusText = _a.statusText, url = _a.url;
2137 // The body will be read out if present.
2138 var body = null;
2139 if (status !== 204 /* NoContent */) {
2140 // Use XMLHttpRequest.response if set, responseText otherwise.
2141 body = (typeof xhr.response === 'undefined') ? xhr.responseText : xhr.response;
2142 }
2143 // Normalize another potential bug (this one comes from CORS).
2144 if (status === 0) {
2145 status = !!body ? 200 /* Ok */ : 0;
2146 }
2147 // ok determines whether the response will be transmitted on the event or
2148 // error channel. Unsuccessful status codes (not 2xx) will always be errors,
2149 // but a successful status code can still result in an error if the user
2150 // asked for JSON data and the body cannot be parsed as such.
2151 var ok = status >= 200 && status < 300;
2152 // Check whether the body needs to be parsed as JSON (in many cases the browser
2153 // will have done that already).
2154 if (req.responseType === 'json' && typeof body === 'string') {
2155 // Save the original body, before attempting XSSI prefix stripping.
2156 var originalBody = body;
2157 body = body.replace(XSSI_PREFIX, '');
2158 try {
2159 // Attempt the parse. If it fails, a parse error should be delivered to the user.
2160 body = body !== '' ? JSON.parse(body) : null;
2161 }
2162 catch (error) {
2163 // Since the JSON.parse failed, it's reasonable to assume this might not have been a
2164 // JSON response. Restore the original body (including any XSSI prefix) to deliver
2165 // a better error response.
2166 body = originalBody;
2167 // If this was an error request to begin with, leave it as a string, it probably
2168 // just isn't JSON. Otherwise, deliver the parsing error to the user.
2169 if (ok) {
2170 // Even though the response status was 2xx, this is still an error.
2171 ok = false;
2172 // The parse error contains the text of the body that failed to parse.
2173 body = { error: error, text: body };
2174 }
2175 }
2176 }
2177 if (ok) {
2178 // A successful response is delivered on the event stream.
2179 observer.next(new HttpResponse({
2180 body: body,
2181 headers: headers,
2182 status: status,
2183 statusText: statusText,
2184 url: url || undefined,
2185 }));
2186 // The full body has been received and delivered, no further events
2187 // are possible. This request is complete.
2188 observer.complete();
2189 }
2190 else {
2191 // An unsuccessful request is delivered on the error channel.
2192 observer.error(new HttpErrorResponse({
2193 // The error in this case is the response body (error from the server).
2194 error: body,
2195 headers: headers,
2196 status: status,
2197 statusText: statusText,
2198 url: url || undefined,
2199 }));
2200 }
2201 };
2202 // The onError callback is called when something goes wrong at the network level.
2203 // Connection timeout, DNS error, offline, etc. These are actual errors, and are
2204 // transmitted on the error channel.
2205 var onError = function (error) {
2206 var url = partialFromXhr().url;
2207 var res = new HttpErrorResponse({
2208 error: error,
2209 status: xhr.status || 0,
2210 statusText: xhr.statusText || 'Unknown Error',
2211 url: url || undefined,
2212 });
2213 observer.error(res);
2214 };
2215 // The sentHeaders flag tracks whether the HttpResponseHeaders event
2216 // has been sent on the stream. This is necessary to track if progress
2217 // is enabled since the event will be sent on only the first download
2218 // progerss event.
2219 var sentHeaders = false;
2220 // The download progress event handler, which is only registered if
2221 // progress events are enabled.
2222 var onDownProgress = function (event) {
2223 // Send the HttpResponseHeaders event if it hasn't been sent already.
2224 if (!sentHeaders) {
2225 observer.next(partialFromXhr());
2226 sentHeaders = true;
2227 }
2228 // Start building the download progress event to deliver on the response
2229 // event stream.
2230 var progressEvent = {
2231 type: exports.HttpEventType.DownloadProgress,
2232 loaded: event.loaded,
2233 };
2234 // Set the total number of bytes in the event if it's available.
2235 if (event.lengthComputable) {
2236 progressEvent.total = event.total;
2237 }
2238 // If the request was for text content and a partial response is
2239 // available on XMLHttpRequest, include it in the progress event
2240 // to allow for streaming reads.
2241 if (req.responseType === 'text' && !!xhr.responseText) {
2242 progressEvent.partialText = xhr.responseText;
2243 }
2244 // Finally, fire the event.
2245 observer.next(progressEvent);
2246 };
2247 // The upload progress event handler, which is only registered if
2248 // progress events are enabled.
2249 var onUpProgress = function (event) {
2250 // Upload progress events are simpler. Begin building the progress
2251 // event.
2252 var progress = {
2253 type: exports.HttpEventType.UploadProgress,
2254 loaded: event.loaded,
2255 };
2256 // If the total number of bytes being uploaded is available, include
2257 // it.
2258 if (event.lengthComputable) {
2259 progress.total = event.total;
2260 }
2261 // Send the event.
2262 observer.next(progress);
2263 };
2264 // By default, register for load and error events.
2265 xhr.addEventListener('load', onLoad);
2266 xhr.addEventListener('error', onError);
2267 xhr.addEventListener('timeout', onError);
2268 xhr.addEventListener('abort', onError);
2269 // Progress events are only enabled if requested.
2270 if (req.reportProgress) {
2271 // Download progress is always enabled if requested.
2272 xhr.addEventListener('progress', onDownProgress);
2273 // Upload progress depends on whether there is a body to upload.
2274 if (reqBody !== null && xhr.upload) {
2275 xhr.upload.addEventListener('progress', onUpProgress);
2276 }
2277 }
2278 // Fire the request, and notify the event stream that it was fired.
2279 xhr.send(reqBody);
2280 observer.next({ type: exports.HttpEventType.Sent });
2281 // This is the return from the Observable function, which is the
2282 // request cancellation handler.
2283 return function () {
2284 // On a cancellation, remove all registered event listeners.
2285 xhr.removeEventListener('error', onError);
2286 xhr.removeEventListener('abort', onError);
2287 xhr.removeEventListener('load', onLoad);
2288 xhr.removeEventListener('timeout', onError);
2289 if (req.reportProgress) {
2290 xhr.removeEventListener('progress', onDownProgress);
2291 if (reqBody !== null && xhr.upload) {
2292 xhr.upload.removeEventListener('progress', onUpProgress);
2293 }
2294 }
2295 // Finally, abort the in-flight request.
2296 if (xhr.readyState !== xhr.DONE) {
2297 xhr.abort();
2298 }
2299 };
2300 });
2301 };
2302 return HttpXhrBackend;
2303 }());
2304 HttpXhrBackend.decorators = [
2305 { type: core.Injectable }
2306 ];
2307 HttpXhrBackend.ctorParameters = function () { return [
2308 { type: common.XhrFactory }
2309 ]; };
2310
2311 /**
2312 * @license
2313 * Copyright Google LLC All Rights Reserved.
2314 *
2315 * Use of this source code is governed by an MIT-style license that can be
2316 * found in the LICENSE file at https://angular.io/license
2317 */
2318 var XSRF_COOKIE_NAME = new core.InjectionToken('XSRF_COOKIE_NAME');
2319 var XSRF_HEADER_NAME = new core.InjectionToken('XSRF_HEADER_NAME');
2320 /**
2321 * Retrieves the current XSRF token to use with the next outgoing request.
2322 *
2323 * @publicApi
2324 */
2325 var HttpXsrfTokenExtractor = /** @class */ (function () {
2326 function HttpXsrfTokenExtractor() {
2327 }
2328 return HttpXsrfTokenExtractor;
2329 }());
2330 /**
2331 * `HttpXsrfTokenExtractor` which retrieves the token from a cookie.
2332 */
2333 var HttpXsrfCookieExtractor = /** @class */ (function () {
2334 function HttpXsrfCookieExtractor(doc, platform, cookieName) {
2335 this.doc = doc;
2336 this.platform = platform;
2337 this.cookieName = cookieName;
2338 this.lastCookieString = '';
2339 this.lastToken = null;
2340 /**
2341 * @internal for testing
2342 */
2343 this.parseCount = 0;
2344 }
2345 HttpXsrfCookieExtractor.prototype.getToken = function () {
2346 if (this.platform === 'server') {
2347 return null;
2348 }
2349 var cookieString = this.doc.cookie || '';
2350 if (cookieString !== this.lastCookieString) {
2351 this.parseCount++;
2352 this.lastToken = common.ɵparseCookieValue(cookieString, this.cookieName);
2353 this.lastCookieString = cookieString;
2354 }
2355 return this.lastToken;
2356 };
2357 return HttpXsrfCookieExtractor;
2358 }());
2359 HttpXsrfCookieExtractor.decorators = [
2360 { type: core.Injectable }
2361 ];
2362 HttpXsrfCookieExtractor.ctorParameters = function () { return [
2363 { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
2364 { type: String, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] },
2365 { type: String, decorators: [{ type: core.Inject, args: [XSRF_COOKIE_NAME,] }] }
2366 ]; };
2367 /**
2368 * `HttpInterceptor` which adds an XSRF token to eligible outgoing requests.
2369 */
2370 var HttpXsrfInterceptor = /** @class */ (function () {
2371 function HttpXsrfInterceptor(tokenService, headerName) {
2372 this.tokenService = tokenService;
2373 this.headerName = headerName;
2374 }
2375 HttpXsrfInterceptor.prototype.intercept = function (req, next) {
2376 var lcUrl = req.url.toLowerCase();
2377 // Skip both non-mutating requests and absolute URLs.
2378 // Non-mutating requests don't require a token, and absolute URLs require special handling
2379 // anyway as the cookie set
2380 // on our origin is not the same as the token expected by another origin.
2381 if (req.method === 'GET' || req.method === 'HEAD' || lcUrl.startsWith('http://') ||
2382 lcUrl.startsWith('https://')) {
2383 return next.handle(req);
2384 }
2385 var token = this.tokenService.getToken();
2386 // Be careful not to overwrite an existing header of the same name.
2387 if (token !== null && !req.headers.has(this.headerName)) {
2388 req = req.clone({ headers: req.headers.set(this.headerName, token) });
2389 }
2390 return next.handle(req);
2391 };
2392 return HttpXsrfInterceptor;
2393 }());
2394 HttpXsrfInterceptor.decorators = [
2395 { type: core.Injectable }
2396 ];
2397 HttpXsrfInterceptor.ctorParameters = function () { return [
2398 { type: HttpXsrfTokenExtractor },
2399 { type: String, decorators: [{ type: core.Inject, args: [XSRF_HEADER_NAME,] }] }
2400 ]; };
2401
2402 /**
2403 * @license
2404 * Copyright Google LLC All Rights Reserved.
2405 *
2406 * Use of this source code is governed by an MIT-style license that can be
2407 * found in the LICENSE file at https://angular.io/license
2408 */
2409 /**
2410 * An injectable `HttpHandler` that applies multiple interceptors
2411 * to a request before passing it to the given `HttpBackend`.
2412 *
2413 * The interceptors are loaded lazily from the injector, to allow
2414 * interceptors to themselves inject classes depending indirectly
2415 * on `HttpInterceptingHandler` itself.
2416 * @see `HttpInterceptor`
2417 */
2418 var HttpInterceptingHandler = /** @class */ (function () {
2419 function HttpInterceptingHandler(backend, injector) {
2420 this.backend = backend;
2421 this.injector = injector;
2422 this.chain = null;
2423 }
2424 HttpInterceptingHandler.prototype.handle = function (req) {
2425 if (this.chain === null) {
2426 var interceptors = this.injector.get(HTTP_INTERCEPTORS, []);
2427 this.chain = interceptors.reduceRight(function (next, interceptor) { return new HttpInterceptorHandler(next, interceptor); }, this.backend);
2428 }
2429 return this.chain.handle(req);
2430 };
2431 return HttpInterceptingHandler;
2432 }());
2433 HttpInterceptingHandler.decorators = [
2434 { type: core.Injectable }
2435 ];
2436 HttpInterceptingHandler.ctorParameters = function () { return [
2437 { type: HttpBackend },
2438 { type: core.Injector }
2439 ]; };
2440 /**
2441 * Constructs an `HttpHandler` that applies interceptors
2442 * to a request before passing it to the given `HttpBackend`.
2443 *
2444 * Use as a factory function within `HttpClientModule`.
2445 *
2446 *
2447 */
2448 function interceptingHandler(backend, interceptors) {
2449 if (interceptors === void 0) { interceptors = []; }
2450 if (!interceptors) {
2451 return backend;
2452 }
2453 return interceptors.reduceRight(function (next, interceptor) { return new HttpInterceptorHandler(next, interceptor); }, backend);
2454 }
2455 /**
2456 * Factory function that determines where to store JSONP callbacks.
2457 *
2458 * Ordinarily JSONP callbacks are stored on the `window` object, but this may not exist
2459 * in test environments. In that case, callbacks are stored on an anonymous object instead.
2460 *
2461 *
2462 */
2463 function jsonpCallbackContext() {
2464 if (typeof window === 'object') {
2465 return window;
2466 }
2467 return {};
2468 }
2469 /**
2470 * Configures XSRF protection support for outgoing requests.
2471 *
2472 * For a server that supports a cookie-based XSRF protection system,
2473 * use directly to configure XSRF protection with the correct
2474 * cookie and header names.
2475 *
2476 * If no names are supplied, the default cookie name is `XSRF-TOKEN`
2477 * and the default header name is `X-XSRF-TOKEN`.
2478 *
2479 * @publicApi
2480 */
2481 var HttpClientXsrfModule = /** @class */ (function () {
2482 function HttpClientXsrfModule() {
2483 }
2484 /**
2485 * Disable the default XSRF protection.
2486 */
2487 HttpClientXsrfModule.disable = function () {
2488 return {
2489 ngModule: HttpClientXsrfModule,
2490 providers: [
2491 { provide: HttpXsrfInterceptor, useClass: NoopInterceptor },
2492 ],
2493 };
2494 };
2495 /**
2496 * Configure XSRF protection.
2497 * @param options An object that can specify either or both
2498 * cookie name or header name.
2499 * - Cookie name default is `XSRF-TOKEN`.
2500 * - Header name default is `X-XSRF-TOKEN`.
2501 *
2502 */
2503 HttpClientXsrfModule.withOptions = function (options) {
2504 if (options === void 0) { options = {}; }
2505 return {
2506 ngModule: HttpClientXsrfModule,
2507 providers: [
2508 options.cookieName ? { provide: XSRF_COOKIE_NAME, useValue: options.cookieName } : [],
2509 options.headerName ? { provide: XSRF_HEADER_NAME, useValue: options.headerName } : [],
2510 ],
2511 };
2512 };
2513 return HttpClientXsrfModule;
2514 }());
2515 HttpClientXsrfModule.decorators = [
2516 { type: core.NgModule, args: [{
2517 providers: [
2518 HttpXsrfInterceptor,
2519 { provide: HTTP_INTERCEPTORS, useExisting: HttpXsrfInterceptor, multi: true },
2520 { provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor },
2521 { provide: XSRF_COOKIE_NAME, useValue: 'XSRF-TOKEN' },
2522 { provide: XSRF_HEADER_NAME, useValue: 'X-XSRF-TOKEN' },
2523 ],
2524 },] }
2525 ];
2526 /**
2527 * Configures the [dependency injector](guide/glossary#injector) for `HttpClient`
2528 * with supporting services for XSRF. Automatically imported by `HttpClientModule`.
2529 *
2530 * You can add interceptors to the chain behind `HttpClient` by binding them to the
2531 * multiprovider for built-in [DI token](guide/glossary#di-token) `HTTP_INTERCEPTORS`.
2532 *
2533 * @publicApi
2534 */
2535 var HttpClientModule = /** @class */ (function () {
2536 function HttpClientModule() {
2537 }
2538 return HttpClientModule;
2539 }());
2540 HttpClientModule.decorators = [
2541 { type: core.NgModule, args: [{
2542 /**
2543 * Optional configuration for XSRF protection.
2544 */
2545 imports: [
2546 HttpClientXsrfModule.withOptions({
2547 cookieName: 'XSRF-TOKEN',
2548 headerName: 'X-XSRF-TOKEN',
2549 }),
2550 ],
2551 /**
2552 * Configures the [dependency injector](guide/glossary#injector) where it is imported
2553 * with supporting services for HTTP communications.
2554 */
2555 providers: [
2556 HttpClient,
2557 { provide: HttpHandler, useClass: HttpInterceptingHandler },
2558 HttpXhrBackend,
2559 { provide: HttpBackend, useExisting: HttpXhrBackend },
2560 ],
2561 },] }
2562 ];
2563 /**
2564 * Configures the [dependency injector](guide/glossary#injector) for `HttpClient`
2565 * with supporting services for JSONP.
2566 * Without this module, Jsonp requests reach the backend
2567 * with method JSONP, where they are rejected.
2568 *
2569 * You can add interceptors to the chain behind `HttpClient` by binding them to the
2570 * multiprovider for built-in [DI token](guide/glossary#di-token) `HTTP_INTERCEPTORS`.
2571 *
2572 * @publicApi
2573 */
2574 var HttpClientJsonpModule = /** @class */ (function () {
2575 function HttpClientJsonpModule() {
2576 }
2577 return HttpClientJsonpModule;
2578 }());
2579 HttpClientJsonpModule.decorators = [
2580 { type: core.NgModule, args: [{
2581 providers: [
2582 JsonpClientBackend,
2583 { provide: JsonpCallbackContext, useFactory: jsonpCallbackContext },
2584 { provide: HTTP_INTERCEPTORS, useClass: JsonpInterceptor, multi: true },
2585 ],
2586 },] }
2587 ];
2588
2589 /**
2590 * @license
2591 * Copyright Google LLC All Rights Reserved.
2592 *
2593 * Use of this source code is governed by an MIT-style license that can be
2594 * found in the LICENSE file at https://angular.io/license
2595 */
2596 /**
2597 * A wrapper around the `XMLHttpRequest` constructor.
2598 *
2599 * @publicApi
2600 * @see `XhrFactory`
2601 * @deprecated
2602 * `XhrFactory` has moved, please import `XhrFactory` from `@angular/common` instead.
2603 */
2604 var XhrFactory = common.XhrFactory;
2605
2606 /**
2607 * @license
2608 * Copyright Google LLC All Rights Reserved.
2609 *
2610 * Use of this source code is governed by an MIT-style license that can be
2611 * found in the LICENSE file at https://angular.io/license
2612 */
2613
2614 /**
2615 * Generated bundle index. Do not edit.
2616 */
2617
2618 exports.HTTP_INTERCEPTORS = HTTP_INTERCEPTORS;
2619 exports.HttpBackend = HttpBackend;
2620 exports.HttpClient = HttpClient;
2621 exports.HttpClientJsonpModule = HttpClientJsonpModule;
2622 exports.HttpClientModule = HttpClientModule;
2623 exports.HttpClientXsrfModule = HttpClientXsrfModule;
2624 exports.HttpContext = HttpContext;
2625 exports.HttpContextToken = HttpContextToken;
2626 exports.HttpErrorResponse = HttpErrorResponse;
2627 exports.HttpHandler = HttpHandler;
2628 exports.HttpHeaderResponse = HttpHeaderResponse;
2629 exports.HttpHeaders = HttpHeaders;
2630 exports.HttpParams = HttpParams;
2631 exports.HttpRequest = HttpRequest;
2632 exports.HttpResponse = HttpResponse;
2633 exports.HttpResponseBase = HttpResponseBase;
2634 exports.HttpUrlEncodingCodec = HttpUrlEncodingCodec;
2635 exports.HttpXhrBackend = HttpXhrBackend;
2636 exports.HttpXsrfTokenExtractor = HttpXsrfTokenExtractor;
2637 exports.JsonpClientBackend = JsonpClientBackend;
2638 exports.JsonpInterceptor = JsonpInterceptor;
2639 exports.XhrFactory = XhrFactory;
2640 exports.ɵHttpInterceptingHandler = HttpInterceptingHandler;
2641 exports.ɵangular_packages_common_http_http_a = NoopInterceptor;
2642 exports.ɵangular_packages_common_http_http_b = JsonpCallbackContext;
2643 exports.ɵangular_packages_common_http_http_c = jsonpCallbackContext;
2644 exports.ɵangular_packages_common_http_http_d = XSRF_COOKIE_NAME;
2645 exports.ɵangular_packages_common_http_http_e = XSRF_HEADER_NAME;
2646 exports.ɵangular_packages_common_http_http_f = HttpXsrfCookieExtractor;
2647 exports.ɵangular_packages_common_http_http_g = HttpXsrfInterceptor;
2648
2649 Object.defineProperty(exports, '__esModule', { value: true });
2650
2651})));
2652//# sourceMappingURL=common-http.umd.js.map
Note: See TracBrowser for help on using the repository browser.