Socket
Socket
Sign inDemoInstall

connect-history-api-fallback

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-history-api-fallback - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

4

lib/index.js

@@ -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.',

2

package.json
{
"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);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc