From 063b7e277f53422eb3f975cbcf0a53b41e70fe1e Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 21 Aug 2018 23:32:43 +0800 Subject: [PATCH] fix api body parser --- route/api/twitch/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/route/api/twitch/index.js b/route/api/twitch/index.js index db0e683..a166733 100644 --- a/route/api/twitch/index.js +++ b/route/api/twitch/index.js @@ -67,7 +67,7 @@ r.get('/channel/:chid', checkSession, getChannelList, hasChannel('chid'), async c.obj = resObject('Success', {channel: c.state.channel}) }) -r.put('/channel/:chid/botjoin', checkSession, getChannelList, hasChannel('chid'), async (c, n) => { +r.put('/channel/:chid/botjoin', checkSession, getChannelList, hasChannel('chid'), koaBody(), async (c, n) => { if (!c.chkBody('join', 'number')) throw genError('DataFormat') let join = toInt(c.request.body.join, 0, 0, 1) let text = `update "public"."twitch_channel" set "join" = $1 where "id" = $2` @@ -82,7 +82,7 @@ r.put('/channel/:chid/botjoin', checkSession, getChannelList, hasChannel('chid') c.obj = resObject('Success') }) -r.put('/channel/:chid/opay', checkSession, getChannelList, hasChannel('chid'), async (c, n) => { +r.put('/channel/:chid/opay', checkSession, getChannelList, hasChannel('chid'), koaBody(), async (c, n) => { if (!c.chkBody('opay', 'string', true)) throw genError('DataFormat') let text = `update "public"."twitch_channel" set "opayid" = $1 where "id" = $2`