mirror of
https://github.com/sstent/node.git
synced 2026-01-26 15:12:37 +00:00
updated app
This commit is contained in:
0
first-project/node_modules/gzippo/test/fixtures/js/nestedTest.js
generated
vendored
Normal file
0
first-project/node_modules/gzippo/test/fixtures/js/nestedTest.js
generated
vendored
Normal file
BIN
first-project/node_modules/gzippo/test/fixtures/space the final frontier/tomg.co.png
generated
vendored
Normal file
BIN
first-project/node_modules/gzippo/test/fixtures/space the final frontier/tomg.co.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
1
first-project/node_modules/gzippo/test/fixtures/test.js
generated
vendored
Normal file
1
first-project/node_modules/gzippo/test/fixtures/test.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
alert("hello");
|
||||
BIN
first-project/node_modules/gzippo/test/fixtures/test.js.gzip
generated
vendored
Normal file
BIN
first-project/node_modules/gzippo/test/fixtures/test.js.gzip
generated
vendored
Normal file
Binary file not shown.
BIN
first-project/node_modules/gzippo/test/fixtures/tomg.co.png
generated
vendored
Normal file
BIN
first-project/node_modules/gzippo/test/fixtures/tomg.co.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
first-project/node_modules/gzippo/test/fixtures/user.gzip
generated
vendored
Normal file
BIN
first-project/node_modules/gzippo/test/fixtures/user.gzip
generated
vendored
Normal file
Binary file not shown.
4
first-project/node_modules/gzippo/test/fixtures/user.json
generated
vendored
Normal file
4
first-project/node_modules/gzippo/test/fixtures/user.json
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "tomgallacher",
|
||||
"website": "www.tomgallacher.info"
|
||||
}
|
||||
0
first-project/node_modules/gzippo/test/fixtures/utf8.gz
generated
vendored
Normal file
0
first-project/node_modules/gzippo/test/fixtures/utf8.gz
generated
vendored
Normal file
32
first-project/node_modules/gzippo/test/fixtures/utf8.txt
generated
vendored
Normal file
32
first-project/node_modules/gzippo/test/fixtures/utf8.txt
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
English: The quick brown fox jumps over the lazy dog.
|
||||
Jamaican: Chruu, a kwik di kwik brong fox a jomp huova di liezi daag de, yu no siit?
|
||||
Irish: "An ḃfuil do ċroí ag bualaḋ ó ḟaitíos an ġrá a ṁeall lena ṗóg éada ó ṡlí do leasa ṫú?" "D'ḟuascail Íosa Úrṁac na hÓiġe Beannaiṫe pór Éava agus Áḋaiṁ."
|
||||
Dutch: Pa's wijze lynx bezag vroom het fikse aquaduct.
|
||||
German: Falsches Üben von Xylophonmusik quält jeden größeren Zwerg. (1)
|
||||
German: Im finſteren Jagdſchloß am offenen Felsquellwaſſer patzte der affig-flatterhafte kauzig-höfliche Bäcker über ſeinem verſifften kniffligen C-Xylophon. (2)
|
||||
Norwegian: Blåbærsyltetøy ("blueberry jam", includes every extra letter used in Norwegian).
|
||||
Swedish: Flygande bäckasiner söka strax hwila på mjuka tuvor.
|
||||
Icelandic: Sævör grét áðan því úlpan var ónýt.
|
||||
Finnish: (5) Törkylempijävongahdus (This is a perfect pangram, every letter appears only once. Translating it is an art on its own, but I'll say "rude lover's yelp". :-D)
|
||||
Finnish: (5) Albert osti fagotin ja töräytti puhkuvan melodian. (Albert bought a bassoon and hooted an impressive melody.)
|
||||
Finnish: (5) On sangen hauskaa, että polkupyörä on maanteiden jokapäiväinen ilmiö. (It's pleasantly amusing, that the bicycle is an everyday sight on the roads.)
|
||||
Polish: Pchnąć w tę łódź jeża lub osiem skrzyń fig.
|
||||
Czech: Příliš žluťoučký kůň úpěl ďábelské kódy.
|
||||
Slovak: Starý kôň na hŕbe kníh žuje tíško povädnuté ruže, na stĺpe sa ďateľ učí kvákať novú ódu o živote.
|
||||
Greek (monotonic): ξεσκεπάζω την ψυχοφθόρα βδελυγμία
|
||||
Greek (polytonic): ξεσκεπάζω τὴν ψυχοφθόρα βδελυγμία
|
||||
Russian: Съешь же ещё этих мягких французских булок да выпей чаю.
|
||||
Russian: В чащах юга жил-был цитрус? Да, но фальшивый экземпляр! ёъ.
|
||||
Bulgarian: Жълтата дюля беше щастлива, че пухът, който цъфна, замръзна като гьон.
|
||||
Sami (Northern): Vuol Ruoŧa geđggiid leat máŋga luosa ja čuovžža.
|
||||
Hungarian: Árvíztűrő tükörfúrógép.
|
||||
Spanish: El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y frío, añoraba a su querido cachorro.
|
||||
Portuguese: O próximo vôo à noite sobre o Atlântico, põe freqüentemente o único médico. (3)
|
||||
French: Les naïfs ægithales hâtifs pondant à Noël où il gèle sont sûrs d'être déçus en voyant leurs drôles d'œufs abîmés.
|
||||
Esperanto: Eĥoŝanĝo ĉiuĵaŭde.
|
||||
Hebrew: זה כיף סתם לשמוע איך תנצח קרפד עץ טוב בגן.
|
||||
Japanese (Hiragana):
|
||||
いろはにほへど ちりぬるを
|
||||
わがよたれぞ つねならむ
|
||||
うゐのおくやま けふこえて
|
||||
あさきゆめみじ ゑひもせず (4)
|
||||
BIN
first-project/node_modules/gzippo/test/fixtures/utf8.txt.gz
generated
vendored
Normal file
BIN
first-project/node_modules/gzippo/test/fixtures/utf8.txt.gz
generated
vendored
Normal file
Binary file not shown.
88
first-project/node_modules/gzippo/test/prefexTest.js
generated
vendored
Normal file
88
first-project/node_modules/gzippo/test/prefexTest.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var staticProvider,
|
||||
assert = require('assert'),
|
||||
should = require('should'),
|
||||
http = require('http'),
|
||||
gzippo = require('../');
|
||||
|
||||
try {
|
||||
staticProvider = require('connect');
|
||||
} catch (e) {
|
||||
staticProvider = require('express');
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to ./test/fixtures/
|
||||
*/
|
||||
|
||||
var fixturesPath = __dirname + '/fixtures';
|
||||
|
||||
module.exports = {
|
||||
'requesting without a prefix succeeds': function() {
|
||||
var app = staticProvider.createServer(
|
||||
gzippo.staticGzip(fixturesPath)
|
||||
);
|
||||
|
||||
assert.response(app,
|
||||
{
|
||||
url: '/user.json',
|
||||
headers: {
|
||||
'Accept-Encoding':"gzip"
|
||||
}
|
||||
},
|
||||
function(res){
|
||||
var gzippedData = res.body;
|
||||
res.statusCode.should.equal(200);
|
||||
res.headers.should.have.property('content-type', 'application/json; charset=UTF-8');
|
||||
res.headers.should.have.property('content-length', '69');
|
||||
res.headers.should.have.property('content-encoding', 'gzip');
|
||||
}
|
||||
);
|
||||
},
|
||||
'requesting with a prefix succeeds': function() {
|
||||
var app = staticProvider.createServer(
|
||||
gzippo.staticGzip(fixturesPath, { prefix: '/resource' })
|
||||
);
|
||||
|
||||
assert.response(app,
|
||||
{
|
||||
url: '/resource/user.json',
|
||||
headers: {
|
||||
'Accept-Encoding':"gzip"
|
||||
}
|
||||
},
|
||||
function(res){
|
||||
var gzippedData = res.body;
|
||||
res.statusCode.should.equal(200);
|
||||
res.headers.should.have.property('content-type', 'application/json; charset=UTF-8');
|
||||
res.headers.should.have.property('content-length', '69');
|
||||
res.headers.should.have.property('content-encoding', 'gzip');
|
||||
}
|
||||
);
|
||||
},
|
||||
'requesting with a / prefix succeeds': function() {
|
||||
var app = staticProvider.createServer(
|
||||
gzippo.staticGzip(fixturesPath, { prefix: '/'})
|
||||
);
|
||||
|
||||
assert.response(app,
|
||||
{
|
||||
url: '/user.json',
|
||||
headers: {
|
||||
'Accept-Encoding':"gzip"
|
||||
}
|
||||
},
|
||||
function(res){
|
||||
var gzippedData = res.body;
|
||||
res.statusCode.should.equal(200);
|
||||
res.headers.should.have.property('content-type', 'application/json; charset=UTF-8');
|
||||
res.headers.should.have.property('content-length', '69');
|
||||
res.headers.should.have.property('content-encoding', 'gzip');
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
190
first-project/node_modules/gzippo/test/staticGzipTest.js
generated
vendored
Normal file
190
first-project/node_modules/gzippo/test/staticGzipTest.js
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var staticProvider,
|
||||
assert = require('assert'),
|
||||
should = require('should'),
|
||||
http = require('http'),
|
||||
gzippo = require('../'),
|
||||
crypto = require('crypto'),
|
||||
fs = require('fs'),
|
||||
shasum = crypto.createHash('sha1');
|
||||
|
||||
try {
|
||||
staticProvider = require('connect');
|
||||
} catch (e) {
|
||||
staticProvider = require('express');
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to ./test/fixtures/
|
||||
*/
|
||||
|
||||
var fixturesPath = __dirname + '/fixtures';
|
||||
|
||||
function getApp() {
|
||||
return staticProvider.createServer(gzippo.staticGzip(fixturesPath));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
'requesting gzipped json file succeeds': function() {
|
||||
assert.response(getApp(),
|
||||
{
|
||||
url: '/user.json',
|
||||
headers: {
|
||||
'Accept-Encoding':"gzip"
|
||||
}
|
||||
},
|
||||
function(res){
|
||||
var gzippedData = res.body;
|
||||
assert.response(getApp(), { url: '/user.gzip' }, function(res) {
|
||||
assert.equal(gzippedData, res.body, "Data is not gzipped");
|
||||
});
|
||||
res.statusCode.should.equal(200);
|
||||
res.headers.should.have.property('content-type', 'application/json; charset=UTF-8');
|
||||
res.headers.should.have.property('content-length', '69');
|
||||
res.headers.should.have.property('content-encoding', 'gzip');
|
||||
}
|
||||
);
|
||||
},
|
||||
'requesting gzipped js file succeeds': function() {
|
||||
assert.response(getApp(),
|
||||
{
|
||||
url: '/test.js',
|
||||
headers: {
|
||||
'Accept-Encoding':"gzip"
|
||||
}
|
||||
},
|
||||
function(res){
|
||||
var gzippedData = res.body;
|
||||
assert.response(getApp(), { url: '/test.js.gzip' }, function(res) {
|
||||
assert.equal(gzippedData, res.body, "Data is not gzipped");
|
||||
});
|
||||
|
||||
res.statusCode.should.equal(200);
|
||||
res.headers.should.have.property('content-type', 'application/javascript; charset=UTF-8');
|
||||
res.headers.should.have.property('content-length', '35');
|
||||
res.headers.should.have.property('content-encoding', 'gzip');
|
||||
}
|
||||
);
|
||||
},
|
||||
'requesting js file without gzip succeeds': function() {
|
||||
assert.response(getApp(),
|
||||
{
|
||||
url: '/test.js'
|
||||
},
|
||||
function(res){
|
||||
var gzippedData = res.body;
|
||||
|
||||
fs.readFile(fixturesPath + '/test.js', function (err, data) {
|
||||
if (err) throw err;
|
||||
assert.equal(gzippedData, data, "Data returned does not match file data on filesystem");
|
||||
});
|
||||
|
||||
res.statusCode.should.equal(200);
|
||||
res.headers.should.have.property('content-length', '15');
|
||||
}
|
||||
);
|
||||
},
|
||||
'requesting gzipped utf-8 file succeeds': function() {
|
||||
assert.response(getApp(),
|
||||
{
|
||||
url: '/utf8.txt',
|
||||
headers: {
|
||||
'Accept-Encoding':"gzip"
|
||||
}
|
||||
},
|
||||
function(res){
|
||||
var gzippedData = res.body;
|
||||
assert.response(getApp(), { url: '/utf8.txt.gz' }, function(res) {
|
||||
assert.equal(gzippedData, res.body, "Data is not gzipped");
|
||||
});
|
||||
|
||||
res.statusCode.should.equal(200);
|
||||
res.headers.should.have.property('content-type', 'text/plain; charset=UTF-8');
|
||||
res.headers.should.have.property('content-length', '2031');
|
||||
res.headers.should.have.property('content-encoding', 'gzip');
|
||||
}
|
||||
);
|
||||
},
|
||||
'requesting gzipped utf-8 file returns 304': function() {
|
||||
assert.response(getApp(),
|
||||
{
|
||||
url: '/utf8.txt',
|
||||
headers: {
|
||||
'Accept-Encoding': "gzip"
|
||||
}
|
||||
},
|
||||
function(res) {
|
||||
res.statusCode.should.equal(200);
|
||||
assert.response(getApp(),
|
||||
{
|
||||
url: '/utf8.txt',
|
||||
headers: {
|
||||
'Accept-Encoding': "gzip",
|
||||
'If-Modified-Since': res.headers['last-modified']
|
||||
}
|
||||
},
|
||||
function(res2) {
|
||||
res2.statusCode.should.equal(304);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
'requesting gzipped utf-8 file returns 200': function() {
|
||||
assert.response(getApp(),
|
||||
{
|
||||
url: '/utf8.txt',
|
||||
headers: {
|
||||
'Accept-Encoding': "gzip"
|
||||
}
|
||||
},
|
||||
function(res) {
|
||||
res.statusCode.should.equal(200);
|
||||
}
|
||||
);
|
||||
},
|
||||
'ensuring max age is set on resources which are passed to the default static content provider': function() {
|
||||
assert.response(getApp(),
|
||||
{
|
||||
url: '/tomg.co.png'
|
||||
},
|
||||
function(res) {
|
||||
res.headers.should.have.property('cache-control', 'public, max-age=604800');
|
||||
}
|
||||
);
|
||||
},
|
||||
'Ensuring that when viewing a directory a redirect works correctly': function() {
|
||||
assert.response(getApp(),
|
||||
{
|
||||
url: '/js'
|
||||
},
|
||||
function(res) {
|
||||
res.statusCode.should.not.equal(301);
|
||||
}
|
||||
);
|
||||
},
|
||||
'ensuring that gzippo works with a space in a static content path': function() {
|
||||
assert.response(getApp(),
|
||||
{
|
||||
url: '/space%20the%20final%20frontier/tomg.co.png'
|
||||
},
|
||||
function(res) {
|
||||
res.statusCode.should.not.equal(404);
|
||||
}
|
||||
);
|
||||
},
|
||||
'Ensuring req.url isnt passed to staticSend on error': function() {
|
||||
assert.response(getApp(),
|
||||
{
|
||||
url: '/etc/passwd'
|
||||
},
|
||||
function(res) {
|
||||
res.statusCode.should.equal(404);
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user