mirror of
https://github.com/mgerb/mywebsite
synced 2026-03-07 00:35:23 +00:00
Added files
This commit is contained in:
50
node_modules/nodemailer/node_modules/hyperquest/test/auth.js
generated
vendored
Normal file
50
node_modules/nodemailer/node_modules/hyperquest/test/auth.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
var test = require('tape');
|
||||
var http = require('http');
|
||||
var hyperquest = require('../');
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
var au = req.headers.authorization;
|
||||
if (!au) return res.end('ACCESS DENIED');
|
||||
|
||||
var buf = Buffer(au.replace(/^Basic\s+/, ''), 'base64');
|
||||
var s = buf.toString().split(':');
|
||||
|
||||
if (s[0] === 'moo' && s[1] === 'hax') {
|
||||
res.end('WELCOME TO ZOMBO COM');
|
||||
}
|
||||
else {
|
||||
res.end('ACCESS DENIED!!!');
|
||||
}
|
||||
});
|
||||
|
||||
test('basic auth', function (t) {
|
||||
t.plan(3);
|
||||
server.listen(0, function () {
|
||||
var port = server.address().port;
|
||||
checkUnauth(t, port);
|
||||
checkValid(t, port);
|
||||
checkInvalid(t, port);
|
||||
});
|
||||
t.on('end', server.close.bind(server));
|
||||
});
|
||||
|
||||
function checkUnauth (t, port) {
|
||||
var r = hyperquest('http://localhost:' + port);
|
||||
var data = '';
|
||||
r.on('data', function (buf) { data += buf });
|
||||
r.on('end', function () { t.equal(data, 'ACCESS DENIED') });
|
||||
}
|
||||
|
||||
function checkValid (t, port) {
|
||||
var r = hyperquest('http://moo:hax@localhost:' + port);
|
||||
var data = '';
|
||||
r.on('data', function (buf) { data += buf });
|
||||
r.on('end', function () { t.equal(data, 'WELCOME TO ZOMBO COM') });
|
||||
}
|
||||
|
||||
function checkInvalid (t, port) {
|
||||
var r = hyperquest('http://beep:boop@localhost:' + port);
|
||||
var data = '';
|
||||
r.on('data', function (buf) { data += buf });
|
||||
r.on('end', function () { t.equal(data, 'ACCESS DENIED!!!') });
|
||||
}
|
||||
50
node_modules/nodemailer/node_modules/hyperquest/test/auth_encoded.js
generated
vendored
Normal file
50
node_modules/nodemailer/node_modules/hyperquest/test/auth_encoded.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
var test = require('tape');
|
||||
var http = require('http');
|
||||
var hyperquest = require('../');
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
var au = req.headers.authorization;
|
||||
if (!au) return res.end('ACCESS DENIED');
|
||||
|
||||
var buf = Buffer(au.replace(/^Basic\s+/, ''), 'base64');
|
||||
var s = buf.toString().split(':');
|
||||
|
||||
if (s[0] === 'm##' && s[1] === 'h@x') {
|
||||
res.end('WELCOME TO ZOMBO COM');
|
||||
}
|
||||
else {
|
||||
res.end('ACCESS DENIED!!!');
|
||||
}
|
||||
});
|
||||
|
||||
test('basic auth with escaped params', function (t) {
|
||||
t.plan(3);
|
||||
server.listen(0, function () {
|
||||
var port = server.address().port;
|
||||
checkUnauth(t, port);
|
||||
checkValid(t, port);
|
||||
checkInvalid(t, port);
|
||||
});
|
||||
t.on('end', server.close.bind(server));
|
||||
});
|
||||
|
||||
function checkUnauth (t, port) {
|
||||
var r = hyperquest('http://localhost:' + port);
|
||||
var data = '';
|
||||
r.on('data', function (buf) { data += buf });
|
||||
r.on('end', function () { t.equal(data, 'ACCESS DENIED') });
|
||||
}
|
||||
|
||||
function checkValid (t, port) {
|
||||
var r = hyperquest('http://m%23%23:h%40x@localhost:' + port);
|
||||
var data = '';
|
||||
r.on('data', function (buf) { data += buf });
|
||||
r.on('end', function () { t.equal(data, 'WELCOME TO ZOMBO COM') });
|
||||
}
|
||||
|
||||
function checkInvalid (t, port) {
|
||||
var r = hyperquest('http://beep:boop@localhost:' + port);
|
||||
var data = '';
|
||||
r.on('data', function (buf) { data += buf });
|
||||
r.on('end', function () { t.equal(data, 'ACCESS DENIED!!!') });
|
||||
}
|
||||
50
node_modules/nodemailer/node_modules/hyperquest/test/auth_opt.js
generated
vendored
Normal file
50
node_modules/nodemailer/node_modules/hyperquest/test/auth_opt.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
var test = require('tape');
|
||||
var http = require('http');
|
||||
var hyperquest = require('../');
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
var au = req.headers.authorization;
|
||||
if (!au) return res.end('ACCESS DENIED');
|
||||
|
||||
var buf = Buffer(au.replace(/^Basic\s+/, ''), 'base64');
|
||||
var s = buf.toString().split(':');
|
||||
|
||||
if (s[0] === 'moo' && s[1] === 'hax') {
|
||||
res.end('WELCOME TO ZOMBO COM');
|
||||
}
|
||||
else {
|
||||
res.end('ACCESS DENIED!!!');
|
||||
}
|
||||
});
|
||||
|
||||
test('basic opts.auth', function (t) {
|
||||
t.plan(3);
|
||||
server.listen(0, function () {
|
||||
var port = server.address().port;
|
||||
checkUnauth(t, port);
|
||||
checkValid(t, port);
|
||||
checkInvalid(t, port);
|
||||
});
|
||||
t.on('end', server.close.bind(server));
|
||||
});
|
||||
|
||||
function checkUnauth (t, port) {
|
||||
var r = hyperquest('http://localhost:' + port);
|
||||
var data = '';
|
||||
r.on('data', function (buf) { data += buf });
|
||||
r.on('end', function () { t.equal(data, 'ACCESS DENIED') });
|
||||
}
|
||||
|
||||
function checkValid (t, port) {
|
||||
var r = hyperquest('http://localhost:' + port, { auth: 'moo:hax' });
|
||||
var data = '';
|
||||
r.on('data', function (buf) { data += buf });
|
||||
r.on('end', function () { t.equal(data, 'WELCOME TO ZOMBO COM') });
|
||||
}
|
||||
|
||||
function checkInvalid (t, port) {
|
||||
var r = hyperquest('http://localhost:' + port, { auth: 'beep:boop' });
|
||||
var data = '';
|
||||
r.on('data', function (buf) { data += buf });
|
||||
r.on('end', function () { t.equal(data, 'ACCESS DENIED!!!') });
|
||||
}
|
||||
37
node_modules/nodemailer/node_modules/hyperquest/test/get.js
generated
vendored
Normal file
37
node_modules/nodemailer/node_modules/hyperquest/test/get.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
var test = require('tape');
|
||||
var http = require('http');
|
||||
var hyperquest = require('../');
|
||||
var through = require('through2');
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
res.setHeader('content-type', 'text/robot-speak');
|
||||
res.end('beep boop');
|
||||
});
|
||||
|
||||
test('get', function (t) {
|
||||
t.plan(3);
|
||||
server.listen(0, function () {
|
||||
var port = server.address().port;
|
||||
check(t, port);
|
||||
});
|
||||
t.on('end', server.close.bind(server));
|
||||
});
|
||||
|
||||
function check (t, port) {
|
||||
var r = hyperquest('http://localhost:' + port);
|
||||
r.pipe(through(write, end));
|
||||
|
||||
r.on('request', function (req) {
|
||||
t.ok(req);
|
||||
});
|
||||
|
||||
r.on('response', function (res) {
|
||||
t.equal(res.headers['content-type'], 'text/robot-speak');
|
||||
});
|
||||
|
||||
var data = '';
|
||||
function write (buf, enc, cb) { data += buf; cb() }
|
||||
function end () {
|
||||
t.equal(data, 'beep boop');
|
||||
}
|
||||
}
|
||||
34
node_modules/nodemailer/node_modules/hyperquest/test/many.js
generated
vendored
Normal file
34
node_modules/nodemailer/node_modules/hyperquest/test/many.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
var test = require('tape');
|
||||
var http = require('http');
|
||||
var hyperquest = require('../');
|
||||
var through = require('through2');
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
res.write('beep boop');
|
||||
});
|
||||
|
||||
test('more than 5 pending connections', function (t) {
|
||||
t.plan(20);
|
||||
var pending = [];
|
||||
server.listen(0, function () {
|
||||
var port = server.address().port;
|
||||
for (var i = 0; i < 20; i++) {
|
||||
pending.push(check(t, port));
|
||||
}
|
||||
});
|
||||
t.on('end', function () {
|
||||
pending.forEach(function (p) { p.destroy() });
|
||||
server.close();
|
||||
});
|
||||
});
|
||||
|
||||
function check (t, port) {
|
||||
var r = hyperquest('http://localhost:' + port);
|
||||
var data = '';
|
||||
r.pipe(through(function (buf, enc, cb) { data += buf; cb() }));
|
||||
|
||||
setTimeout(function () {
|
||||
t.equal(data, 'beep boop');
|
||||
}, 100);
|
||||
return r;
|
||||
}
|
||||
34
node_modules/nodemailer/node_modules/hyperquest/test/opts.js
generated
vendored
Normal file
34
node_modules/nodemailer/node_modules/hyperquest/test/opts.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
var test = require('tape');
|
||||
var http = require('http');
|
||||
var hyperquest = require('../');
|
||||
var through = require('through2');
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
res.setHeader('content-type', 'text/robot-speak');
|
||||
res.end('beep boop');
|
||||
});
|
||||
|
||||
test('1st-arg options', function (t) {
|
||||
t.plan(2);
|
||||
server.listen(0, function () {
|
||||
var port = server.address().port;
|
||||
check(t, port);
|
||||
});
|
||||
t.on('end', server.close.bind(server));
|
||||
});
|
||||
|
||||
function check (t, port) {
|
||||
var r = hyperquest(
|
||||
{ uri: 'http://localhost:' + port },
|
||||
function (err, res) {
|
||||
t.equal(res.headers['content-type'], 'text/robot-speak');
|
||||
}
|
||||
);
|
||||
r.pipe(through(write, end));
|
||||
|
||||
var data = '';
|
||||
function write (buf, enc, cb) { data += buf; cb() }
|
||||
function end () {
|
||||
t.equal(data, 'beep boop');
|
||||
}
|
||||
}
|
||||
39
node_modules/nodemailer/node_modules/hyperquest/test/post.js
generated
vendored
Normal file
39
node_modules/nodemailer/node_modules/hyperquest/test/post.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var test = require('tape');
|
||||
var http = require('http');
|
||||
var hyperquest = require('../');
|
||||
var through = require('through2');
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
req.pipe(through(function (buf, enc, cb) {
|
||||
this.push(String(buf).toUpperCase());
|
||||
cb();
|
||||
})).pipe(res);
|
||||
});
|
||||
|
||||
test('post', function (t) {
|
||||
t.plan(1);
|
||||
server.listen(0, function () {
|
||||
var port = server.address().port;
|
||||
check(t, port);
|
||||
});
|
||||
t.on('end', server.close.bind(server));
|
||||
});
|
||||
|
||||
function check (t, port) {
|
||||
var r = hyperquest.post('http://localhost:' + port);
|
||||
r.pipe(through(write, end));
|
||||
|
||||
setTimeout(function () {
|
||||
r.write('beep ');
|
||||
}, 50);
|
||||
|
||||
setTimeout(function () {
|
||||
r.end('boop.');
|
||||
}, 100);
|
||||
|
||||
var data = '';
|
||||
function write (buf, enc, cb) { data += buf; cb() }
|
||||
function end () {
|
||||
t.equal(data, 'BEEP BOOP.');
|
||||
}
|
||||
}
|
||||
31
node_modules/nodemailer/node_modules/hyperquest/test/post_immediate.js
generated
vendored
Normal file
31
node_modules/nodemailer/node_modules/hyperquest/test/post_immediate.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
var test = require('tape');
|
||||
var http = require('http');
|
||||
var hyperquest = require('../');
|
||||
var through = require('through2');
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
req.pipe(through(function (buf, enc, cb) {
|
||||
this.push(String(buf).toUpperCase());
|
||||
cb();
|
||||
})).pipe(res);
|
||||
});
|
||||
|
||||
test('post', function (t) {
|
||||
t.plan(1);
|
||||
server.listen(0, function () {
|
||||
var port = server.address().port;
|
||||
check(t, port);
|
||||
});
|
||||
t.on('end', server.close.bind(server));
|
||||
});
|
||||
|
||||
function check (t, port) {
|
||||
var r = hyperquest.post('http://localhost:' + port);
|
||||
r.end('beep boop.');
|
||||
|
||||
var data = '';
|
||||
r.on('data', function (buf) { data += buf });
|
||||
r.on('end', function () {
|
||||
t.equal(data, 'BEEP BOOP.');
|
||||
});
|
||||
}
|
||||
20
node_modules/nodemailer/node_modules/hyperquest/test/readable.js
generated
vendored
Normal file
20
node_modules/nodemailer/node_modules/hyperquest/test/readable.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var test = require('tape');
|
||||
var hyperquest = require('../');
|
||||
var http = require('http');
|
||||
|
||||
var server = http.createServer(function (req, res) { res.end() });
|
||||
|
||||
test('readable', function (t) {
|
||||
server.listen(function () {
|
||||
var port = server.address().port;
|
||||
var req = hyperquest('http://localhost:' + port);
|
||||
t.notOk(req.flowing);
|
||||
t.ok(req._read);
|
||||
req.on('data', function () {});
|
||||
req.on('end', function () {
|
||||
server.close();
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
30
node_modules/nodemailer/node_modules/hyperquest/test/set_header.js
generated
vendored
Normal file
30
node_modules/nodemailer/node_modules/hyperquest/test/set_header.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
var test = require('tape');
|
||||
var http = require('http');
|
||||
var hyperquest = require('../');
|
||||
var through = require('through2');
|
||||
|
||||
test('setHeader on a request', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
t.equal(req.headers.robot, 'party');
|
||||
res.end('beep boop');
|
||||
});
|
||||
server.listen(0, function () {
|
||||
var port = server.address().port;
|
||||
check(t, port);
|
||||
});
|
||||
t.on('end', server.close.bind(server));
|
||||
});
|
||||
|
||||
function check (t, port) {
|
||||
var r = hyperquest('http://localhost:' + port);
|
||||
r.setHeader('robot', 'party');
|
||||
r.pipe(through(write, end));
|
||||
|
||||
var data = '';
|
||||
function write (buf, enc, cb) { data += buf; cb() }
|
||||
function end () {
|
||||
t.equal(data, 'beep boop');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user