Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl --json #8314

Closed
wants to merge 3 commits into from
Closed

curl --json #8314

wants to merge 3 commits into from

Conversation

bagder
Copy link
Member

@bagder bagder commented Jan 21, 2022

--json <data> is a shortcut for --data-binary <data> -H "Content-Type: application/json" -H "Accept: application/json"

While the discussion continues on the curl-users list and in #8312, here's something to check and play with.

@jay
Copy link
Member

jay commented Jan 21, 2022

I'd call it --data-json for consistency with all the other --data-foo I changed my mind it grew on me after reading the discussion in #8312 particularly dch's comments

@bagder

This comment has been minimized.

@bmarwell
Copy link

Can I still overwrite the accept header? Some restful endpoints might return a document, an image etc instead.

@jzakrzewski
Copy link
Contributor

@bagder
Copy link
Member Author

bagder commented Jan 28, 2022

Yes, exactly like we're used to. The test cases I added verify that both headers this option sets can be overridden.

 383 - simple single command line option
 384 - reading it from stdin
 385 - getting two --json options on command line
 386 - --next works after --json
@bagder
Copy link
Member Author

bagder commented Jan 31, 2022

Ok, I'll merge this within 24 hours.

@bagder bagder closed this in 32160ca Feb 1, 2022
@bagder bagder deleted the bagder/json branch February 1, 2022 09:42
@curl curl deleted a comment from 1999chato Mar 12, 2022
@curl curl locked as resolved and limited conversation to collaborators Mar 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

4 participants