@@ -50,18 +50,16 @@ const server = http2.createSecureServer(options, (req, res) => {
5050
5151 res .writeHead (200 , {' content-type' : ' text/html' });
5252
53- const favicon = res .createPushResponse ();
54- favicon .path = ' /favicon.ico' ;
55- favicon .push ((req , res ) => {
56- res .setHeader (' content-type' , ' image/jpeg' );
57- fs .createReadStream (' /some/image.jpg' ).pipe (res);
53+ const favicon = res .createPushRequest ({' :path' : ' /favicon.ico' });
54+ favicon .push ((err , res ) => {
55+ res .setHeader (' content-type' , ' image/png' );
56+ fs .createReadStream (' /some/logo.png' ).pipe (res);
5857 });
5958
60- const pushResponse = res .createPushResponse ();
61- pushResponse .path = ' /image.jpg' ;
62- pushResponse .push ((req , res ) => {
59+ const pushResponse = res .createPushRequest ({' :path' : ' /image.jpg' });
60+ pushResponse .push ((err , res ) => {
6361 res .setHeader (' content-type' , ' image/jpeg' );
64- fs .createReadStream (' /some/image/ jpg' ).pipe (res);
62+ fs .createReadStream (' /some/image. jpg' ).pipe (res);
6563 });
6664
6765 res .end (' <html><head><link rel="preload" href="/favicon.ico"/></head>' +
@@ -299,7 +297,7 @@ The `'rst-stream'` event is emitted when a RST-STREAM frame is received.
299297### Method: ` response.writeHeader(statusCode, headers) `
300298### Method: ` response.write() `
301299### Method: ` response.end() `
302- ### Method: ` response.createPushResponse( ) `
300+ ### Method: ` response.createPushRequest(headers ) `
303301
304302## HTTP2.createServerSession(options)
305303
0 commit comments