this.on(['GET', 'HEAD'], '/admin', this.handlerRedirect.bind(this), `${options.dingus.proxyPrefix}/admin/`);
this.on(['GET', 'HEAD'], '/admin/', this.handlerGetAdminOverview.bind(this));
this.on(['GET', 'HEAD'], '/admin/topic/:topicId', this.handlerGetAdminTopicDetails.bind(this));
+ this.on(['GET', 'HEAD'], '/admin/topic/:topicId/history.svg', this.handlerGetHistorySVG.bind(this));
// Private data-editing endpoints
this.on(['PATCH', 'DELETE'], '/admin/topic/:topicId', this.handlerUpdateTopic.bind(this));
}
+ async handlerGetHistorySVG(req, res, ctx) {
+ const _scope = _fileScope('handlerGetHist');
+ this.logger.debug(_scope, 'called', { req: common.requestLogData(req), ctx });
+
+ const responseTypes = [Enum.ContentType.ImageSVG];
+
+ Dingus.setHeadHandler(req, res, ctx);
+
+ this.setResponseType(responseTypes, req, res, ctx);
+
+ await this.manager.getHistorySVG(res, ctx);
+ }
+
+
/**
* @param {http.ClientRequest} req
* @param {http.ServerResponse} res
/**
- * Similar to super.ingestBody, but if no body was sent, do not parse (and
- * thus avoid possible unsupported media type error).
- * Also removes raw body from context, to simplify scrubbing sensitive data from logs.
+ * If no body was sent, do not parse (and thus avoid possible unsupported media type error).
* @param {http.ClientRequest} req
* @param {http.ServerResponse} res
* @param {Object} ctx
*/
async maybeIngestBody(req, res, ctx) {
- ctx.rawBody = await this.bodyData(req);
- const contentType = Dingus.getRequestContentType(req);
- if (ctx.rawBody) {
- this.parseBody(contentType, ctx);
- delete ctx.rawBody;
- }
+ return super.ingestBody(req, res, ctx, {
+ parseEmptyBody: false,
+ });
}