I just installed Ubuntu 21.04. I was surprised to find that the version of curl that comes installed does not display JSON response bodies in many cases... I'm still trying to understand why sometimes JSON bodies are shown and other times they aren't. In some cases adding -H "Accept: application/json"
to the calls does display the body, but I've never needed to specify that before.
Unfortunately, the APIs I discovered this with are company-internal so I can't post the specific example, but I will say they are APIs hosted on AWS ApiGateway in case that's helpful. GET response bodies are JSON, and display fine on both Debian and macOS.
- The version of curl on my Ubuntu computer is 7.74
- The version on my work computer (macOS) is 7.64
- running
curl -v https://api.company.com/dev/endpoint
on my Ubuntu machine and work MacBook produce nearly identical outputs ending with
* Connection #0 to host api.company.com left intact
on both machines, but on macOS there's an additional line containing the body
{"internal_code": "ok", ....}* Closing connection 0
Finally, I'll add that...
- the JSON response body of
curl https://reqbin.com/echo/get/json
does display on Ubuntu, and sometimes the bodies from the internal API display if I add -H "Accept: application/json"
to the curl (but not always).
- HTML response bodies seem to show always.