0xSpaceShard / starknet-devnet-rs

A local testnet for Starknet... in Rust
https://0xspaceshard.github.io/starknet-devnet-rs/
MIT License
100 stars 56 forks source link

Deserialize empty body (missing params in JSON-RPC case) as empty JSON object #532

Closed 3alpha closed 1 week ago

3alpha commented 2 weeks ago

Describe the bug (observed vs expected behavior)

When API endpoint has all optional paramaters, deserialization shouldn't fail when request body is empty.

Not reproducible on testnet

To Reproduce Steps to reproduce the behavior:

This fails: curl -X POST http://127.0.0.1:5050/dump It shouldn't fail, and it should behave identicaly as: curl -X POST http://127.0.0.1:5050/dump -d '{}'

In JSON-RPC case, this fails:

{
  "method": "devnet_dump",
  "id": "1",
  "jsonrpc": "2.0"
}

And this doesn't:

{
  "method": "devnet_dump",
  "id": "1",
  "jsonrpc": "2.0",
  "params": {}
}

As before, both cases should behave identically. Devnet version