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

electricity

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electricity - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

12

lib/index.js

@@ -331,2 +331,8 @@ var crypto = require('crypto');

if (reqInfo.hash !== file.hash) {
res.set({
'Cache-Control': 'no-cache',
'Expires': '0',
'Pragma': 'no-cache'
});
return res.redirect(hashifyPath(reqInfo.path, file.hash));

@@ -351,5 +357,7 @@ }

if (req.get('If-None-Match') === file.hash) {
res.send(304);
res.status(304);
res.end();
} else if (new Date(req.get('If-Modified-Since')) >= file.modified) {
res.send(304);
res.status(304);
res.end();
} else {

@@ -356,0 +364,0 @@ res.set({

2

package.json

@@ -35,3 +35,3 @@ {

},
"version": "1.2.2"
"version": "1.2.3"
}

@@ -129,2 +129,3 @@ var assert = require('assert');

});
it.skip('calls res.send with asset contents if the asset does exist', function(done) {

@@ -151,2 +152,3 @@ req.path = '/robots.txt';

});
it('calls res.send with asset contents if the asset does exist and has its hash appended', function(done) {

@@ -173,2 +175,3 @@ req.path = '/robots-ca121b5d03245bf82db00d14cee04e22.txt';

});
it('calls res.send with custom headers if specified', function(done) {

@@ -208,2 +211,3 @@ var midwareWithHeaders = electricity.static('test/public', {

});
it('should only remove the hash from the path', function(done) {

@@ -230,2 +234,3 @@ req.path = '/robots-abc1de.home-ca121b5d03245bf82db00d14cee04e22.txt';

});
it('correctly serves files from subdirectories', function(done) {

@@ -252,3 +257,4 @@ req.path = '/styles/normalize-dc691d63a0d03f7c0dba9f0eda398b5b.css';

});
it('sends a 302 redirect if the hash does not match the current file', function(done) {
it.only('sends a 302 redirect if the hash does not match the current file', function(done) {
var redirected = false;

@@ -255,0 +261,0 @@ req.path = '/robots-ca121b5d03245bf82db00d1455555555.txt';

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