diff --git a/flaska.mjs b/flaska.mjs index 88002ac..679df06 100644 --- a/flaska.mjs +++ b/flaska.mjs @@ -989,7 +989,10 @@ ctx.state.nonce = nonce; let length = 0 - if (typeof(body) === 'object' && body) { + if (body instanceof Buffer) { + length = body.byteLength + ctx.type = ctx.type || 'application/octet-stream' + } else if (typeof(body) === 'object' && body) { body = JSON.stringify(body) length = Buffer.byteLength(body) ctx.type = 'application/json; charset=utf-8' diff --git a/package.json b/package.json index 54c6c1b..05bd337 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flaska", - "version": "1.3.2", + "version": "1.3.3", "description": "Flaska is a micro web-framework for node. It is designed to be fast, simple and lightweight, and is distributed as a single file module with no dependencies.", "main": "flaska.mjs", "scripts": {