UNPKG

1.28 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@apollo/client/core')) :
3 typeof define === 'function' && define.amd ? define('apollo-angular/headers', ['exports', '@angular/common/http', '@apollo/client/core'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ngApollo = global.ngApollo || {}, global.ngApollo.headers = {}), global.ng.common.http, global.core));
5}(this, (function (exports, http, core) { 'use strict';
6
7 var httpHeaders = function () {
8 return new core.ApolloLink(function (operation, forward) {
9 var getContext = operation.getContext, setContext = operation.setContext;
10 var context = getContext();
11 if (context.headers) {
12 setContext(Object.assign(Object.assign({}, context), { headers: new http.HttpHeaders(context.headers) }));
13 }
14 return forward(operation);
15 });
16 };
17
18 /**
19 * Generated bundle index. Do not edit.
20 */
21
22 exports.httpHeaders = httpHeaders;
23
24 Object.defineProperty(exports, '__esModule', { value: true });
25
26})));
27//# sourceMappingURL=ngApolloLinkHeaders.umd.js.map