Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

connect-cachify

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-cachify - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

2

lib/connect-cachify.js

@@ -154,3 +154,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

} else {
return format('%s%s/%s', opts.prefix, hash, filename);
return format('%s%s%s%s', opts.prefix, hash, filename[0] === '/' ? '' : '/', filename);
}

@@ -157,0 +157,0 @@ };

@@ -6,3 +6,3 @@ {

"keywords": ["cache", "HTTP", "expires", "asset", "max-age", "caching"],
"version": "0.0.9",
"version": "0.0.10",
"homepage": "http://github.com/mozilla/connect-cachify",

@@ -9,0 +9,0 @@ "repository": {

@@ -167,2 +167,41 @@ var cachify = require('../lib/connect-cachify'),

},
"Production mode with absolute URL in prefix": function (test) {
var assets = make_assets(),
req = {
url: '/v/d41d8cd98f/js/main.min.js'
},
resp = {
state: {},
local: function (key, value) {
this.state[key] = value;
},
setHeader: function (key, value) {
this.state[key] = value;
if (!this.state['header']) this.state['header'] = 0;
this.state['header'] += 1;
},
on: function (name, cb) {
}
},
mddlwr;
mddlwr = cachify.setup(
assets, {
root: '/tmp',
prefix: 'http://example.com/v/'
});
var link = cachify.cachify_js("/js/main.min.js");
test.equal(link, '<script src="http://example.com/v/d41d8cd98f/js/main.min.js"></script>',
"Hashes in all urls in production");
var file = cachify.cachify("/js/main.min.js");
test.equal(file, "http://example.com/v/d41d8cd98f/js/main.min.js");
mddlwr(req, resp, function () {
test.ok(resp.state.cachify_js);
test.ok(resp.state.cachify_css);
test.ok(resp.state.cachify);
test.ok(resp.state.header > 0);
test.equal(req.url, '/js/main.min.js');
test.done();
});
},
"Custom prefix works with non-file assets": function (test) {

@@ -169,0 +208,0 @@ var assets = make_assets(),

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