You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone, I am writing a Koa application in TS and I have one problem with the co-body library. It lies in the fact that during one request the maximum number of normally working calls to the parse.json function = 1 (on the second call to the parse.json function, the request always ends with just gateway timeout). And as a result, I have to make crutches in the form of a call to parse.json on one of the most faithful middleware and transfer it to the bottom through ctx, which is why the typing is not done in the best way, the purity of the code suffers and this is lower in performance (because sometimes I no need to call parse.json at all)
An example of a code showing this problem (the parse.json function call is not included in separate middleware, but there is no difference as such)
constkoa=require('koa')constparse=require('co-body')constapp=newkoa()app.use(asyncctx=>{constbodyOk=awaitparse.json(ctx.req)console.log('Body is ok',bodyOk)awaitparse.json(ctx.req)console.log('Will never reach it log...')})constPORT=3000app.listen(PORT,()=>console.log(`API listening on ${PORT}`))
I'm testing this problem through Postman with this content
The text was updated successfully, but these errors were encountered:
Hello everyone, I am writing a Koa application in TS and I have one problem with the co-body library. It lies in the fact that during one request the maximum number of normally working calls to the parse.json function = 1 (on the second call to the parse.json function, the request always ends with just gateway timeout). And as a result, I have to make crutches in the form of a call to parse.json on one of the most faithful middleware and transfer it to the bottom through ctx, which is why the typing is not done in the best way, the purity of the code suffers and this is lower in performance (because sometimes I no need to call parse.json at all)
An example of a code showing this problem (the parse.json function call is not included in separate middleware, but there is no difference as such)
I'm testing this problem through Postman with this content
The text was updated successfully, but these errors were encountered: