Git Product home page Git Product logo

Comments (5)

Jarred-Sumner avatar Jarred-Sumner commented on May 2, 2024 1

working on a fix

from bun.

KishanBagaria avatar KishanBagaria commented on May 2, 2024

looks like it's not fully identical to npm behavior (i've to use \" instead of just "):

(this is fish)

from bun.

kidonng avatar kidonng commented on May 2, 2024

Not sure if the following issue is related:

bat -p package.json 
{
  "name": "blank",
  "version": "0.0.3",
  "module": "src/index.js",
  "scripts": {
    "demo": "echo \"test\""
  },
  "devDependencies": {
    "bun-types": "latest"
  }
}npm run demo

> [email protected] demo
> echo "test"

testbun run demo
$ echo \"test\"
"test"

Basically npm does JSON parsing but bun doesn't seem to do it.

from bun.

Electroid avatar Electroid commented on May 2, 2024

Thanks for reproducing, @kidonng, confirmed it's still an issue as of 0.2.2. We'll get it fixed.

from bun.

lutzissler avatar lutzissler commented on May 2, 2024

Confirming this is still an issue with 0.5.9:

 "scripts": {
        "start": "bun run src/app.ts",
        "add:article": "curl -X POST -H 'Content-Type: application/json' -d '{\"id\":1,\"title\":\"Test article\",\"body\":\"Test body\"}' http://localhost:4000/articles/"
    }

Running this won’t work with Bun:

$ bun run add:article
$ curl -X POST -H 'Content-Type: application/json' -d '{\"id\":1,\"title\":\"Test article\",\"body\":\"Test body\"}' http://localhost:4000/articles/
{
  "title": "Bad Request",
  "status": 400,
  "detail": "Unable to parse JSON: JSON Parse error: Unrecognized token '\\'"
}

But it does with npm:

$ npm run add:article

> @ add:article
> curl -X POST -H 'Content-Type: application/json' -d '{"id":1,"title":"Test article","body":"Test body"}' http://localhost:4000/articles/

The reason is clearly that Bun doesn’t parse JSON as stated above.

from bun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.