UNPKG

apollo-angular-link-headers

Version:

An Apollo Link to easily transform headers from being a key-value object to an instance of HttpHeaders. Great combination with apollo-angular-link-http.

28 lines (22 loc) 1.21 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('apollo-link')) : typeof define === 'function' && define.amd ? define('apollo-angular-link-headers', ['exports', '@angular/common/http', 'apollo-link'], factory) : (global = global || self, factory(global['apollo-angular-link-headers'] = {}, global.ng.common.http, global.apolloLink.core)); }(this, (function (exports, http, apolloLink) { 'use strict'; var httpHeaders = function () { return new apolloLink.ApolloLink(function (operation, forward) { var getContext = operation.getContext, setContext = operation.setContext; var context = getContext(); if (context.headers) { setContext(Object.assign(Object.assign({}, context), { headers: new http.HttpHeaders(context.headers) })); } return forward(operation); }); }; /** * Generated bundle index. Do not edit. */ exports.httpHeaders = httpHeaders; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=ngApolloLinkHeaders.umd.js.map