diff --git a/lib/universal.mjs b/lib/universal.mjs index b777ac3..a5067b4 100644 --- a/lib/universal.mjs +++ b/lib/universal.mjs @@ -102,7 +102,6 @@ const runtime = { const url = utilitas.utilitas.assembleUrl(`/api/${path}`, query || {}); const token = options?.token || getToken(); const optAlert = { alert: options?.alert }; - const textDecoder = new TextDecoder(); let body = null, contentType = null; if (post?.constructor?.name === 'FormData') { body = post; } else if (post) { body = JSON.stringify(post); contentType = _JSON; } @@ -122,6 +121,7 @@ const runtime = { if (options?.stream) { switch (resp.status) { case 200: + const textDecoder = new TextDecoder(); const reader = resp.body.getReader(); for await (const chunk of readChunks(reader)) { await options.stream(textDecoder.decode( diff --git a/lib/webjam.mjs b/lib/webjam.mjs index 1e10917..9e56f8e 100644 --- a/lib/webjam.mjs +++ b/lib/webjam.mjs @@ -128,7 +128,10 @@ const _init = async (options, callback) => { await initSession(options.session, webjam.app); const objRouter = await initRouter(options); webjam.app.use(logger((str, args) => log(str.trim(), { time: true }))); - webjam.app.use(bodyParser({ onerror: (err, ctx) => ctx.error = err })); + webjam.app.use(bodyParser({ + jsonLimit: '100mb', + onerror: (err, ctx) => ctx.error = err + })); webjam.app.use(json()); webjam.app.use(cors); webjam.app.use(userAgent);