okigan / awscurl

curl-like access to AWS resources with AWS Signature Version 4 request signing.
MIT License
737 stars 91 forks source link

Consider printing headers as json #119

Open bibliotechy opened 3 years ago

bibliotechy commented 3 years ago

When the -i flag to include headers in response is provided, a python dict representation (actually the requests custom case-indifferent dict) of the headers are printed. Looks deceptively like JSON at a quick glance.

If the headers were dumped as valid JSON, tools like jq could be used for digging into them, which aids in readability and using that header data as part of a pipeline.

okigan commented 3 years ago

should we revamp it to behave like: https://everything.curl.dev/usingcurl/verbose/writeout

bibliotechy commented 3 years ago

That functionality definitely seems useful, but I don't actually see support for writing out arbitrary headers with any of those variables.

Thinking about curl as the baseline, curl's -i flag prints the headers one per line which at least can be parsed with grep or similar.