lau1944/bunrest

Unexpected end of JSON input

Closed this issue · 2 comments

`
SyntaxError
Unexpected end of JSON input
λ() node_modules/bunrest/src/server/server.ts:240:47

    searchParams.forEach((v, k) => {
      newReq.query[k] = v;
    });

    // append body
    const body: { [key: string]: any } = await req.json();
    /*                                        ^ happened here */

Stack trace:

  λ()          node_modules/bunrest/src/server/server.ts:240:47
  `bunRequest` node_modules/bunrest/src/server/server.ts:222:27
  λ()          node_modules/bunrest/src/server/server.ts:132:38
  `fetch`      node_modules/bunrest/src/server/server.ts:131:33

Info:

bun v1.0.0
wsl #1 SMP Fri Jan 27 02:56:13 UTC 2023 (x64)
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.76
Pathname: /
Screenshot 2023-09-12 133329

`

#18 I would upload the new version to npm soon.
A quick fix will be change your dependency to git

dependencies: { bunrest: https://github.com/lau1944/bunrest.git }

@drescamarian Done. Seems like a json parsing issue.

commit: 8e08fa4