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

express-middleware

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-middleware - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

.npmignore

5

package.json
{
"name": "express-middleware",
"version": "2.0.1",
"version": "2.0.2",
"description": "Set of middlewares for Chauffeur-Privé",

@@ -50,4 +50,3 @@ "keywords": [

"engines": {
"node": ">=6.0.0",
"npm": ">=2.14.7"
"node": ">=6.0.0"
},

@@ -54,0 +53,0 @@ "bugs": {

2

src/middleware/language.js

@@ -42,3 +42,3 @@ 'use strict';

});
return matchingLanguage ? languageObjectToString(matchingLanguage) : null;
return matchingLanguage || null;
}

@@ -45,0 +45,0 @@

@@ -82,2 +82,26 @@ 'use strict';

it('should match exactly the first language found in the Accept-Language header', function test(done) {
const req = { get: () => 'fr-FR,en-US;q=0.7' };
const middleware = language({ languages });
expect(middleware).to.be.instanceof(Function);
middleware(req, null, () => {
expect(req.language).to.equal('fr-FR');
done();
});
});
it('should match the first language found with a partial matching', function test(done) {
const req = { get: () => 'fr,en-US;q=0.7' };
const middleware = language({ languages });
expect(middleware).to.be.instanceof(Function);
middleware(req, null, () => {
expect(req.language).to.equal('fr-FR');
done();
});
});
it('should throw if languages is not set', function test() {

@@ -84,0 +108,0 @@ expect(() => language({ languages: null })).to.throw();

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