Cardano-wallet: Missing content-type application/json;charset=utf-8 for status code 404 on /wallets

Created on 1 Apr 2021  路  2Comments  路  Source: input-output-hk/cardano-wallet

Context

I'm building a library for Elixir that talks to the cardano-wallet and I think I found a bug.

The content-type header seems to be missing when calling http://localhost:8090/v2/wallets/ with an non existing id which returns with status code 404.

This is the headers I get back:
{"date", "Thu, 01 Apr 2021 21:12:48 GMT"},
{"server", "Warp/3.3.5"},
{"content-length", "122"}

If I call the same endpoint but with a badly formatted id which returns a status code 400 I get these headers:
{"date", "Thu, 01 Apr 2021 21:12:48 GMT"},
{"server", "Warp/3.3.5"},
{"content-length", "92"},
{"content-type", "application/json;charset=utf-8"}

The problem with this is that the content type is used by many http clients to automatically decode the json response to a struct so the implementation will be cluttered with workarounds.

Essential Information

  • Version: master
  • Platform: Linux
  • Installation: Built from source
  • Network: testnet

Most helpful comment

I also remember seeing some non-JSON plain text error responses from the API - which would be annoying for API consumers which unconditionally expect JSON. But I forget which error it was... edit: it is the unhandled exception 500 response.
Anyway, WIP PR #2597.

All 2 comments

Good catch thanks. It may actually be the case for other endpoints too :thinking: , we should test this generically using the API data types to make sure not to miss any.

I also remember seeing some non-JSON plain text error responses from the API - which would be annoying for API consumers which unconditionally expect JSON. But I forget which error it was... edit: it is the unhandled exception 500 response.
Anyway, WIP PR #2597.

Was this page helpful?
0 / 5 - 0 ratings