@ampproject/toolbox-optimizer-express
Advanced tools
Comparing version 2.0.1 to 2.3.0
@@ -35,3 +35,3 @@ /** | ||
*/ | ||
static create(ampOptimizer=AmpOptimizer.create()) { | ||
static create(ampOptimizer = AmpOptimizer.create()) { | ||
return (req, res, next) => { | ||
@@ -114,5 +114,6 @@ // If this is a request for a resource, such as image, JS or CSS, do not apply optimizations. | ||
const mimeType = mime.lookup(req.url) || 'text/html'; | ||
return (req.accepts && req.accepts('html') !== 'html') || | ||
mimeType !== 'text/html' && | ||
!req.url.endsWith('/'); // adjust for /abc.com/, which return application/x-msdownload | ||
return ( | ||
(req.accepts && req.accepts('html') !== 'html') || | ||
(mimeType !== 'text/html' && !req.url.endsWith('/')) | ||
); // adjust for /abc.com/, which return application/x-msdownload | ||
} | ||
@@ -119,0 +120,0 @@ } |
{ | ||
"name": "@ampproject/toolbox-optimizer-express", | ||
"version": "2.0.1", | ||
"version": "2.3.0", | ||
"description": "Express middleware for @ampproject/toolbox-optimizer", | ||
@@ -27,9 +27,9 @@ "main": "index.js", | ||
"dependencies": { | ||
"@ampproject/toolbox-core": "^2.0.0", | ||
"@ampproject/toolbox-optimizer": "^2.0.1", | ||
"@ampproject/toolbox-runtime-version": "^2.0.0", | ||
"@ampproject/toolbox-core": "^2.3.0", | ||
"@ampproject/toolbox-optimizer": "^2.3.0", | ||
"@ampproject/toolbox-runtime-version": "^2.3.0", | ||
"mime-types": "2.1.26", | ||
"whatwg-url": "8.0.0" | ||
}, | ||
"gitHead": "2785e09433bb22977b61f153ed7694b68ca5151d" | ||
"gitHead": "bb7eaa6c720044e84f01c6406f5f0805dc637923" | ||
} |
@@ -9,3 +9,3 @@ ## Introduction | ||
The middleware uses the [amp-optimizer](../optimizer) component to apply server-side-rendering on the fly. | ||
The middleware uses the [amp-optimizer](/packages/optimizer) component to apply server-side-rendering on the fly. | ||
@@ -15,3 +15,3 @@ ## How it works | ||
amp-optimizer-express intercepts the responses and replaces their content with a version that has been | ||
transformed by [amp-optimizer](../optimizer). | ||
transformed by [amp-optimizer](/packages/optimizer). | ||
@@ -18,0 +18,0 @@ As the server-side-rendered version of the content is not valid AMP, the component also |
22900
195