X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=src%2Fservice.js;h=c69f6fb7c891366dfbe02e659a54414a05da401d;hb=28de4364128a4b03918a8cbe868009b5d427220a;hp=dfba6b8f9747a20694aa9f8f1c4a268857d5ee5e;hpb=3fae9b64c5c70ad52376558caa71db99778541b0;p=websub-hub diff --git a/src/service.js b/src/service.js index dfba6b8..c69f6fb 100644 --- a/src/service.js +++ b/src/service.js @@ -66,7 +66,7 @@ class Service extends Dingus { * @param {Object} ctx * @param {String} newPath */ - async handlerRedirect(req, res, ctx, newPath) { + async handlerRedirect(req, res, ctx, newPath) { const _scope = _fileScope('handlerRedirect'); this.logger.debug(_scope, 'called', { req: common.requestLogData(req), ctx }); @@ -185,8 +185,9 @@ class Service extends Dingus { await this.manager.getTopicDetails(res, ctx); } + /** - * Same as super.ingestBody, but if no body was send, do not parse (and + * Same as super.ingestBody, but if no body was sent, do not parse (and * thus avoid possible unsupported media type error). * @param {http.ClientRequest} req * @param {http.ServerResponse} res @@ -206,7 +207,7 @@ class Service extends Dingus { * @param {http.ServerResponse} res * @param {Object} ctx */ - async handlerUpdateTopic(req, res, ctx) { + async handlerUpdateTopic(req, res, ctx) { const _scope = _fileScope('handlerUpdateTopic'); this.logger.debug(_scope, 'called', { req: common.requestLogData(req), ctx }); @@ -226,17 +227,17 @@ class Service extends Dingus { * @param {Object} ctx */ async handlerUpdateSubscription(req, res, ctx) { - const _scope = _fileScope('handlerUpdateSubscription'); - this.logger.debug(_scope, 'called', { req: common.requestLogData(req), ctx }); + const _scope = _fileScope('handlerUpdateSubscription'); + this.logger.debug(_scope, 'called', { req: common.requestLogData(req), ctx }); - this.setResponseType(this.responseTypes, req, res, ctx); + this.setResponseType(this.responseTypes, req, res, ctx); - await this.authenticator.required(req, res, ctx); + await this.authenticator.required(req, res, ctx); - await this.maybeIngestBody(req, res, ctx); - ctx.method = req.method; - await this.manager.updateSubscription(res, ctx); -} + await this.maybeIngestBody(req, res, ctx); + ctx.method = req.method; + await this.manager.updateSubscription(res, ctx); + } /** @@ -254,7 +255,7 @@ class Service extends Dingus { this.setResponseType(this.responseTypes, req, res, ctx); await this.serveFile(req, res, ctx, this.staticPath, file || ctx.params.file); - this.logger.info(_scope, 'finished', { ctx }); + this.logger.info(_scope, 'finished', { ctx: { ...ctx, responseBody: common.logTruncate((ctx.responseBody || '').toString(), 100) } }); }