MCPcopy Index your code
hub / github.com/angular/angular / MockHeaders

Class MockHeaders

packages/service-worker/worker/testing/fetch.ts:59–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59export class MockHeaders implements Headers {
60 map = new Map<string, string>();
61
62 constructor(headers?: HeadersInit) {
63 if (headers === undefined) {
64 return;
65 }
66
67 if (Array.isArray(headers)) {
68 headers.forEach(([name, value]) => this.set(name, value));
69 } else if (headers instanceof MockHeaders || headers instanceof Headers) {
70 headers.forEach((value, name) => this.set(name, value));
71 } else {
72 Object.entries(headers).forEach(([name, value]) => this.set(name, value));
73 }
74 }
75
76 [Symbol.iterator]() {
77 return this.map[Symbol.iterator]();
78 }
79
80 append(name: string, value: string): void {
81 this.map.set(name.toLowerCase(), value);
82 }
83
84 delete(name: string): void {
85 this.map.delete(name.toLowerCase());
86 }
87
88 entries() {
89 return this.map.entries();
90 }
91
92 forEach(callback: Function): void {
93 this.map.forEach(callback as any);
94 }
95
96 get(name: string): string | null {
97 return this.map.get(name.toLowerCase()) || null;
98 }
99
100 has(name: string): boolean {
101 return this.map.has(name.toLowerCase());
102 }
103
104 keys() {
105 return this.map.keys();
106 }
107
108 set(name: string, value: string): void {
109 this.map.set(name.toLowerCase(), value);
110 }
111
112 values() {
113 return this.map.values();
114 }
115
116 getSetCookie(): string[] {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…