lau1944 / bunrest

An express-like API for bun server
MIT License
285 stars 31 forks source link

Fixes Unexpected end of JSON input #18

Closed LuisMalhadas closed 1 year ago

LuisMalhadas commented 1 year ago

Verifying the request's body value before executing .json() Solving the following:

GET - /ping failed
236 |       newReq.query[k] = v;
237 |     });
238 | 
239 |     // append body
240 |     const body: { [key: string]: any } = await req.json();
                                                   ^                                                   
SyntaxError: Unexpected end of JSON input

Meant to solve #17