connect-history-api-fallback
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -19,2 +19,6 @@ 'use strict'; | ||
return next(); | ||
} else if (headers.accept.indexOf('application/json') === 0) { | ||
logger('Not rewriting %s %s because the client prefers JSON.', | ||
req.method, req.url); | ||
return next(); | ||
} else if (!acceptsHtml(headers.accept)) { | ||
@@ -21,0 +25,0 @@ logger('Not rewriting %s %s because the client does not accept HTML.', |
{ | ||
"name": "connect-history-api-fallback", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Provides a fallback for non-existing directories so that the HTML 5 history API can be used.", | ||
@@ -5,0 +5,0 @@ "keyswords": ["connect", "html5", "history api", "fallback", "spa"], |
@@ -63,2 +63,13 @@ var historyApiFallback = require('../lib'); | ||
tests['should take JSON preference into account'] = function (test) { | ||
req.headers.accept = 'application/json, text/plain, */*'; | ||
historyApiFallback(req, null, next); | ||
test.equal(req.url, requestedUrl); | ||
test.ok(nextCalled); | ||
test.done(); | ||
}; | ||
tests['should rewrite valid requests'] = function (test) { | ||
@@ -65,0 +76,0 @@ historyApiFallback(req, null, next); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7176
99