- /**
- * Wrap the Dingus head handler, to remove the response body from the context,
- * lest it be logged.
- * @param {http.ClientRequest} req
- * @param {http.ServerResponse} res
- * @param {object} ctx
- */
- static setHeadHandler(req, res, ctx) {
- if (req.method === 'HEAD') {
- Dingus.setHeadHandler(req, res, ctx);
- const origEnd = res.end.bind(res);
- res.end = function (data, encoding, ...rest) {
- const origResult = origEnd(data, encoding, ...rest);
- delete ctx.responseBody;
- return origResult;
- };
- }
- }