X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test-e2e%2Ffake-servers.js;h=20719622ec8b338d6dd6d3ff2d9fa383c72e25c1;hb=b806715f9288323cce7b0ab437ee78b01d26c548;hp=0adff34edadff9d0a1ae7c61cde230a9e8f8d8c3;hpb=9696c012e6b9a6c58904baa397ca0ebf78112316;p=websub-hub diff --git a/test-e2e/fake-servers.js b/test-e2e/fake-servers.js index 0adff34..2071962 100644 --- a/test-e2e/fake-servers.js +++ b/test-e2e/fake-servers.js @@ -46,7 +46,7 @@ class TopicFake extends Dingus { res.setHeader('Link', behavior.selfLink + (behavior.hubLink ? `, ${behavior.hubLink}` : '')); res.statusCode = behavior.statusCode; res.end(behavior.content); - this.logger.info({ method: req.method, statusCode: res.statusCode }); + this.logger.info('TopicFake:getId', { method: req.method, statusCode: res.statusCode, url: req.url }); } async putId(req, res, ctx) { @@ -61,6 +61,7 @@ class TopicFake extends Dingus { }; this.topicBehaviors.set(id, behavior); res.statusCode = 200; + this.logger.info('TopicFake:putId', { method: req.method, statusCode: res.statusCode, url: req.url }); res.end(); } @@ -68,6 +69,7 @@ class TopicFake extends Dingus { this.setResponseType(this.responseTypes, req, res, ctx); this.topicBehaviors.delete(ctx.params.id); res.statusCode = 200; + this.logger.info('TopicFake:deleteId', { method: req.method, statusCode: res.statusCode, url: req.url }); res.end(); } @@ -97,9 +99,9 @@ class SubscriberFake extends Dingus { this.setResponseType(this.responseTypes, req, res, ctx); const behavior = this.verifyBehaviors.get(ctx.params.id); res.statusCode = behavior ? behavior.statusCode : 404; - const response = (behavior && behavior.matchChallenge) ? ctx.queryParams['hub.challenge'] : (behavior && behavior.response); + const response = (behavior?.matchChallenge) ? ctx.queryParams['hub.challenge'] : (behavior?.response); res.end(response); - this.logger.info({ method: req.method, statusCode: res.statusCode, matchChallenge: !!(behavior && behavior.matchChallenge) }); + this.logger.info('SubscriberFake:getId', { method: req.method, statusCode: res.statusCode, matchChallenge: !!(behavior?.matchChallenge), url: req.url }); } async postId(req, res, ctx) { @@ -112,7 +114,7 @@ class SubscriberFake extends Dingus { behavior.content = ctx.rawBody; } res.end(); - this.logger.info({ content: behavior && behavior.content, method: req.method, statusCode: res.statusCode, matchChallenge: !!(behavior && behavior.matchChallenge) }); + this.logger.info('SubscriberFake:postId', { content: behavior?.content, method: req.method, statusCode: res.statusCode, matchChallenge: !!(behavior?.matchChallenge), url: req.url }); } async putVerify(req, res, ctx) { @@ -129,6 +131,7 @@ class SubscriberFake extends Dingus { } res.statusCode = 200; res.end(); + this.logger.info('SubscriberFake:putVerify', { method: req.method, statusCode: res.statusCode, url: req.url }); } async putContent(req, res, ctx) { @@ -139,14 +142,16 @@ class SubscriberFake extends Dingus { this.contentBehaviors.set(ctx.params.id, behavior); res.statusCode = 200; res.end(); + this.logger.info('SubscriberFake:putContent', { method: req.method, statusCode: res.statusCode, url: req.url }); } async deleteId(req, res, ctx) { - this.setResponseType(this.responseTypes, req, res, ctx); - this.contentBehaviors.delete(ctx.params.id); - this.verifyBehaviors.delete(ctx.params.id); - res.statusCode = 200; - res.end(); + this.setResponseType(this.responseTypes, req, res, ctx); + this.contentBehaviors.delete(ctx.params.id); + this.verifyBehaviors.delete(ctx.params.id); + res.statusCode = 200; + res.end(); + this.logger.info('SubscriberFake:deleteId', { method: req.method, statusCode: res.statusCode, url: req.url }); } } // SubscriberFake