fastify-auto-push
Advanced tools
Comparing version
@@ -40,3 +40,2 @@ "use strict"; | ||
const root = opts.root; | ||
const prefix = opts.prefix || ''; | ||
const ap = new autoPush.AutoPush(root, opts.cacheConfig); | ||
@@ -47,5 +46,3 @@ app.register(fastify_static_1.default, opts); | ||
const reqStream = req.stream; | ||
const url = req.url; | ||
let reqPath = url.split('?')[0]; | ||
reqPath = reqPath.replace(prefix, ''); | ||
const reqPath = req.url; | ||
reqStream[REQ_PATH] = reqPath; | ||
@@ -56,3 +53,3 @@ const cookies = cookie.parse(req.headers['cookie'] || ''); | ||
// TODO(jinwoo): Consider making this persistent across sessions. | ||
res.setHeader('set-cookie', cookie.serialize(CACHE_COOKIE_KEY, newCacheCookie)); | ||
res.setHeader('set-cookie', cookie.serialize(CACHE_COOKIE_KEY, newCacheCookie, { path: '/' })); | ||
pushFn(reqStream).then(noop, noop); | ||
@@ -59,0 +56,0 @@ } |
{ | ||
"name": "fastify-auto-push", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "HTTP/2 auto-push middleware for fastify", | ||
@@ -50,3 +50,3 @@ "main": "build/src/index.js", | ||
"cookie": "^0.3.1", | ||
"fastify-plugin": "^0.2.1", | ||
"fastify-plugin": "^0.2.2", | ||
"fastify-static": "^0.8.0", | ||
@@ -58,3 +58,3 @@ "h2-auto-push": "^0.3.0" | ||
"@types/get-port": "^3.2.0", | ||
"@types/node": "^9.4.0", | ||
"@types/node": "^9.4.6", | ||
"@types/send": "^0.14.4", | ||
@@ -67,5 +67,5 @@ "ava": "^0.25.0", | ||
"js-green-licenses": "^0.4.0", | ||
"nyc": "^11.4.1", | ||
"typescript": "~2.7.1" | ||
"nyc": "^11.5.0", | ||
"typescript": "^2.7.2" | ||
} | ||
} |
# Fastify plugin for HTTP/2 automatic server push | ||
[](https://greenkeeper.io/) | ||
**This is not an official Google product.** | ||
@@ -4,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
45
4.65%22180
-0.69%86
-3.37%Updated