fastify-auto-push
Advanced tools
Comparing version
/// <reference types="node" /> | ||
/// <reference types="pino" /> | ||
/// <reference types="fastify" /> | ||
@@ -8,5 +9,8 @@ import * as fastify from 'fastify'; | ||
import * as https from 'https'; | ||
import * as pino from 'pino'; | ||
export { AssetCacheConfig } from 'h2-auto-push'; | ||
export declare type HttpServer = http.Server | https.Server | http2.Http2Server | http2.Http2SecureServer; | ||
export declare type RawRequest = http.IncomingMessage | http2.Http2ServerRequest; | ||
export declare type RawRequest = (http.IncomingMessage | http2.Http2ServerRequest) & { | ||
log?: pino.Logger; | ||
}; | ||
export declare type RawResponse = http.ServerResponse | http2.Http2ServerResponse; | ||
@@ -18,2 +22,2 @@ export interface AutoPushOptions extends fastify.RegisterOptions<HttpServer, RawRequest, RawResponse> { | ||
} | ||
export declare const staticServe: fastify.Plugin<HttpServer, http.IncomingMessage | http2.Http2ServerRequest, http.ServerResponse | http2.Http2ServerResponse, AutoPushOptions>; | ||
export declare const staticServe: fastify.Plugin<HttpServer, RawRequest, http.ServerResponse | http2.Http2ServerResponse, AutoPushOptions>; |
@@ -51,3 +51,6 @@ "use strict"; | ||
res.setHeader('set-cookie', cookie.serialize(CACHE_COOKIE_KEY, newCacheCookie, { path: '/' })); | ||
pushFn(reqStream).then(noop, noop); | ||
reqStream.on('pushError', (err) => { | ||
req.log.error('Error while pushing', err); | ||
}); | ||
pushFn().then(noop, noop); | ||
} | ||
@@ -54,0 +57,0 @@ }); |
{ | ||
"name": "fastify-auto-push", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"description": "HTTP/2 auto-push middleware for fastify", | ||
@@ -52,3 +52,3 @@ "main": "build/src/index.js", | ||
"fastify-static": "^0.10.1", | ||
"h2-auto-push": "^0.3.1" | ||
"h2-auto-push": "^0.4.0" | ||
}, | ||
@@ -58,3 +58,3 @@ "devDependencies": { | ||
"@types/get-port": "^3.2.0", | ||
"@types/node": "^9.4.6", | ||
"@types/node": "^9.6.5", | ||
"@types/send": "^0.14.4", | ||
@@ -65,7 +65,7 @@ "ava": "^0.25.0", | ||
"get-port": "^3.2.0", | ||
"gts": "^0.5.3", | ||
"gts": "^0.5.4", | ||
"js-green-licenses": "^0.5.0", | ||
"nyc": "^11.5.0", | ||
"typescript": "^2.7.2" | ||
"nyc": "^11.7.1", | ||
"typescript": "~2.7.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
22737
1.34%96
7.87%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
Updated