Skip to content

curl --json#8314

Closed
bagder wants to merge 3 commits into
masterfrom
bagder/json
Closed

curl --json#8314
bagder wants to merge 3 commits into
masterfrom
bagder/json

Conversation

@bagder

@bagder bagder commented Jan 21, 2022

Copy link
Copy Markdown
Member

--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

jay commented Jan 21, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown

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

@jzakrzewski

Copy link
Copy Markdown
Contributor

@bagder

bagder commented Jan 28, 2022

Copy link
Copy Markdown
Member Author

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

bagder commented Jan 31, 2022

Copy link
Copy Markdown
Member Author

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.

4 participants