- */
- async ingestBody(req, res, ctx) {
- ctx.rawBody = await this.bodyData(req);
- const contentType = Dingus.getRequestContentType(req);
- this.parseBody(contentType, ctx);
+ * @param {object}
+ * @param {Boolean} .parseEmptyBody
+ * @param {Boolean} .persistRawBody
+ */
+ async ingestBody(req, res, ctx, { parseEmptyBody = true, persistRawBody = false, maximumBodySize } = {}) {
+ const rawBody = await this.bodyData(req, maximumBodySize);
+ if (persistRawBody) {
+ ctx.rawBody = rawBody;
+ }
+ if (rawBody || parseEmptyBody) {
+ const contentType = Dingus.getRequestContentType(req);
+ this.parseBody(contentType, ctx, rawBody);
+ }