Initial commit

This commit is contained in:
abrendan
2023-11-30 14:15:19 +00:00
commit e4599df811
5457 changed files with 500139 additions and 0 deletions

16
node_modules/server/plugins/compress/index.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
const modern = require('../../src/modern');
const compress = require('compression');
module.exports = {
name: 'compress',
options: {
__root: 'compress',
compress: {
default: {},
type: Object
}
},
// The whole plugin won't be loaded if the option is false
before: ctx => modern(compress(ctx.options.compress))(ctx)
};

View File

@@ -0,0 +1,18 @@
const run = require('server/test/run');
describe('compress', () => {
it('works with the defaults', async () => {
const res = await run(() => 'Hello world').get('/');
expect(res.body).toBe('Hello world');
});
it('works with an empty option object', async () => {
const res = await run({ compress: {} }, () => 'Hello world').get('/');
expect(res.body).toBe('Hello world');
});
it('works without compress', async () => {
const res = await run({ compress: false }, () => 'Hello world').get('/');
expect(res.body).toBe('Hello world');
});
});