1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 3x 12x 3x 3x 2x 2x 2x 1x | import {HttpHeaders} from '@angular/common/http';
export const normalizeUrl = (url: string): string =>
url.replace(/^\/|\/$/g, '');
export const mergeHeaders = (
source: HttpHeaders,
destination: HttpHeaders,
): HttpHeaders => {
if (source && destination) {
const merged = destination
.keys()
.reduce(
(headers, name) => headers.set(name, destination.getAll(name)),
source,
);
return merged;
}
return destination || source;
};
|