X-Git-Url: http://git.squeep.com/?p=squeep-indie-auther;a=blobdiff_plain;f=src%2Fservice.js;fp=src%2Fservice.js;h=b26da2f0fa5fa1f6a9f881357ca076196218a5ab;hp=c1e600691642130c40557cffec8721e43f7a2cef;hb=e8dccf76ec2776f07eddd1ce2f1c4fc150a6f790;hpb=4a8977142d1f54e168f6cc7b229133863fcf0dba diff --git a/src/service.js b/src/service.js index c1e6006..b26da2f 100644 --- a/src/service.js +++ b/src/service.js @@ -13,6 +13,7 @@ const { Authenticator, SessionManager } = require('@squeep/authentication-module const { ResourceAuthenticator } = require('@squeep/resource-authentication-module'); const { TemplateHelper: { initContext } } = require('@squeep/html-template-helper'); const Enum = require('./enum'); +const { ResponseError } = require('./errors'); const _fileScope = common.fileScope(__filename); @@ -55,6 +56,9 @@ class Service extends Dingus { // Information page about service this.on(['GET'], '/', this.handlerGetRoot.bind(this)); + // Temmporary to see what rando payload someone is sending us unsolicited + this.on(['POST'], '/', this.handlerWhaGwan.bind(this)); + // Give load-balancers something to check this.on(['GET'], route('healthcheck'), this.handlerGetHealthcheck.bind(this)); @@ -108,7 +112,7 @@ class Service extends Dingus { const logObject = this.asyncLocalStorage.getStore(); // istanbul ignore else - if (logObject) { // debugging in vscode seems to kill ALS, work around + if (logObject) { // Debugging in vscode seems to kill ALS, work around logObject.requestId = ctx.requestId; delete ctx.requestId; } else { @@ -473,6 +477,15 @@ class Service extends Dingus { } + /** + * Temporary to see what an unsolicited payload contains. + */ + async handlerWhaGwan(req, res, ctx) { + this.setResponseType(this.responseTypes, req, res, ctx); + await this.ingestBody(req, res, ctx); + throw new ResponseError(Enum.ErrorResponse.MethodNotAllowed); + } + /** * @param {http.IncomingMessage} req * @param {http.ServerResponse} res