interface HeaderData { [ header ] : string ; } export default class StubHeaders implements Headers { public static make ( data ) { return new StubHeaders ( data ) ; } private data : HeaderData ; private constructor ( data ) { this . data = { } ; for ( const name in data ) { this . set ( name , data [ name ] ) ; } } public append ( name , value ) { this . data [ this . normalizeHeader ( name ) ] = value ; } public delete ( name ) { delete this . data [ this . normalizeHeader ( name ) ] ; } public get ( name ) { return this . data [ this . normalizeHeader ( name ) ] ; } public has ( name ) { return this . normalizeHeader ( name ) in this . data ; } public set ( name , value ) { this . data [ this . normalizeHeader ( name ) ] = value ; } public forEach ( callbackfn ) { for ( const key in this . data ) { callbackfn ( this . data [ key ] , key , this ) ; } } [ Symbol . iterator ] ( ) { throw new Error ( 'Method not implemented.' ) ; } entries ( ) { throw new Error ( 'Method not implemented.' ) ; } keys ( ) { throw new Error ( 'Method not implemented.' ) ; } values ( ) { throw new Error ( 'Method not implemented.' ) ; } private normalizeHeader ( name ) { return name . toLowerCase ( ) ; } }