Restify.createServer({ name: 'Pterodactyl Daemon', certificate: (Config.get('web.ssl.enabled') === true) ? Fs.readFileSync(Config.get('web.ssl.certificate')) : null, key: (Config.get('web.ssl.enabled') === true) ? Fs.readFileSync(Config.get('web.ssl.key')) : null, formatters: { 'application/json': (req, res, body, callback) => { callback(null, JSON.stringify(body, null, 4)); }, }, })
describe('restify instrumentation - integration test', () => { // Restify uses async hooks. Until there is a CLS hooked implementation here, we need to be // explicit with trace IDs. See https://github.com/openzipkin/zipkin-js/issues/88 function addTag(tracer, req, key, value) { tracer.letId(req._trace_id, () => tracer.recordBinary(key, value)); } function middlewareFunction({tracer, routes}) { const app = restify.createServer({handleUncaughtExceptions: true}); app.use(middleware({tracer})); routes.forEach((route) => { app.get(route.path, (req, res, next) => route.handle(req, ({redirect, body, code}) => { if (redirect) { return res.redirect('/weather/peking', next); } else if (body) { return res.send(body); } else if (code) { return res.send(code); } return res.send(); })); }); return app; } serverFixture.setupBasicHttpServerTests({middlewareFunction, addTag}); });
tape('restify - handshake - failed', function(t) { t.plan(4); var server = restify.createServer() , fbbot = new Fbbot(common.fbbot) ; // plug-in fbbot server.get(common.server.endpoint, fbbot.requestHandler); server.post(common.server.endpoint, fbbot.requestHandler); // start the server server.listen(common.server.port, function() { common.sendHandshake('bad', function(error, response) { t.error(error, 'GET request should return no error'); t.equal(response.statusCode, 400, 'GET request should return code 400'); t.equal(response.body, common.handshakes['bad'].error, 'should received error message'); server.close(function() { t.ok(true, 'make sure server is closed'); }); }); }); });
}) const server = restify.createServer() const done = once(() => { server.close()
var server = restify.createServer() , fbbot = new Fbbot(common.fbbot)
var clients = require('restify-clients') var server = restify.createServer({ name: 'foo', version: '1.0.0' })
: defaultRestifyConfig; const server = restify.createServer(restifyConfig);
}) const server = restify.createServer() const done = once(() => { server.close()
describe('#patch', () => { it('should create a span without parent', async () => { const server = restify.createServer() server.get('/', (req, res) => res.send('ok')) tracer.inject(parentSpan, headers) const server = restify.createServer() server.get('/', (req, res) => res.send('ok')) const server = restify.createServer() server.get('/', (req, res) => { res.statusCode = 400
const app = restify.createServer({handleUncaughtExceptions: true}); app.use(middleware({tracer})); routes.forEach((route) => {
}) const server = restify.createServer() const done = once(() => { server.close()
}) const server = restify.createServer() const done = once(() => { server.close()
tape('restify - handshake - success', function(t) { t.plan(4); var server = restify.createServer() , fbbot = new Fbbot(common.fbbot) ; // plug-in fbbot server.get(common.server.endpoint, fbbot.requestHandler); server.post(common.server.endpoint, fbbot.requestHandler); // start the server server.listen(common.server.port, function() { common.sendHandshake('ok', function(error, response) { t.error(error, 'GET request should return no error'); t.equal(response.statusCode, 200, 'GET request should return code 200'); t.equal(response.body, common.handshakes['ok'].query['hub.challenge'], 'should receive provided challenge back'); server.close(function() { t.ok(true, 'make sure server is closed'); }); }); }); });