add option to bodyData() to not render into string
[squeep-api-dingus] / test / lib / dingus.js
index 356974fee0f48342dd80cfd710ccbd91bb64b210..c88921556db4b0d9abcd2decc95abc038f5fd459 100644 (file)
@@ -535,6 +535,14 @@ describe('Dingus', function () {
         assert.strictEqual(e.statusCode, 413);
       }
     });
+    it('provides buffer', async function () {
+      const p = dingus.bodyData(res, 0, false);
+      const expected = Buffer.from('bleat');
+      resEvents['data'](expected);
+      resEvents['end']();
+      const result = await p;
+      assert.deepStrictEqual(result, expected);
+    });
   }); // bodyData
 
   describe('ingestBody', function () {