File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,14 @@ suite('sendNotification', function() {
191191 assert . equal ( requestDetails . headers . authorization , 'key=my_gcm_key' , 'Check GCM Authorization header' ) ;
192192 }
193193 }
194+
195+ const extraHeaders = options . extraOptions && options . extraOptions . headers ;
196+ if ( extraHeaders ) {
197+ Object . keys ( extraHeaders ) . forEach ( function ( header ) {
198+ const normalizedName = header . toLowerCase ( ) ;
199+ assert . equal ( requestDetails . headers [ normalizedName ] , extraHeaders [ header ] , 'Check presence of header ' + header ) ;
200+ } ) ;
201+ }
194202 }
195203
196204 const validRequests = [
@@ -284,6 +292,19 @@ suite('sendNotification', function() {
284292 TTL : 5
285293 }
286294 }
295+ } , {
296+ testTitle : 'send/receive extra headers' ,
297+ requestOptions : {
298+ subscription : {
299+ // The default endpoint will be added by the test
300+ } ,
301+ extraOptions : {
302+ headers : {
303+ Extra : 'extra' ,
304+ 'extra-2' : 'extra-2'
305+ }
306+ }
307+ }
287308 }
288309 ] ;
289310
You can’t perform that action at this time.
0 commit comments