(init = {})
| 7 | |
| 8 | class MockHeaders { |
| 9 | constructor(init = {}) { |
| 10 | this.map = new Map(); |
| 11 | if (init && typeof init.entries === 'function') { |
| 12 | Array.from(init.entries()).forEach(([key, value]) => { |
| 13 | this.set(key, value); |
| 14 | }); |
| 15 | } else { |
| 16 | Object.entries(init).forEach(([key, value]) => { |
| 17 | this.set(key, value); |
| 18 | }); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | get(name) { |
| 23 | return this.map.get(String(name).toLowerCase()) || null; |