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
Trying to add a middleware that reads the number of players and getting a crash saying that the stream is already read.
This error is because I'm using koaBody() in the middleware to read request.body.numPlayers.
The following line also uses koaBody() but fails, since the stream has already been read.
Do I understand correctly that the middleware runs before the router so the body hasn’t been parsed yet? Definitely happy to look at a PR that refactors this! Either by making sure koaBody is called before any middleware to make request.body available everywhere or do what you suggest.
Trying to add a middleware that reads the number of players and getting a crash saying that the stream is already read.
This error is because I'm using
koaBody()
in the middleware to readrequest.body.numPlayers
.The following line also uses
koaBody()
but fails, since the stream has already been read.boardgame.io/src/server/api.ts
Line 233 in afc16c6
I suggest making
koaBody()
happen only if it did not already.Willing to write the code for this if you think this makes sense.
The text was updated successfully, but these errors were encountered: