From bdc08cdfce84145227fef5d2f0b232d6662367b5 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 21 Jan 2022 10:19:23 +0100 Subject: cmdline-opts/json.d: document --json --- docs/cmdline-opts/Makefile.inc | 3 ++- docs/cmdline-opts/json.d | 29 +++++++++++++++++++++++++++++ docs/options-in-versions | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 docs/cmdline-opts/json.d diff --git a/docs/cmdline-opts/Makefile.inc b/docs/cmdline-opts/Makefile.inc index f8b571127..afa3d7931 100644 --- a/docs/cmdline-opts/Makefile.inc +++ b/docs/cmdline-opts/Makefile.inc @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +# Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -111,6 +111,7 @@ DPAGES = \ interface.d \ ipv4.d \ ipv6.d \ + json.d \ junk-session-cookies.d \ keepalive-time.d \ key-type.d \ diff --git a/docs/cmdline-opts/json.d b/docs/cmdline-opts/json.d new file mode 100644 index 000000000..6d18d49ca --- /dev/null +++ b/docs/cmdline-opts/json.d @@ -0,0 +1,29 @@ +Long: json +Arg: +Help: HTTP POST JSON +Protocols: HTTP +See-also: data-binary data-raw +Mutexed: form head upload-file +Category: http post upload +Example: --json '{ "drink": "coffe" }' $URL +Example: --json '{ "drink":' --json ' "coffe" }' $URL +Example: --json @prepared $URL +Example: --json @- $URL < json.txt +Added: 7.82.0 +--- +Sends the specified JSON data in a POST request to the HTTP server. This makes +curl pass the data to the server using the content-type application/json. +\&--json works like an alias for + + --data [arg] --header "Content-Type: application/json" + +There is **no verification** that the passed in data is actual JSON or that +the syntax is correct. + +If this option is used more than once on the same command line, the additional +data pieces will be concatenated to the previous before sending. + +If you start the data with the letter @, the rest should be a file name to +read the data from, or a single dash (-) if you want curl to read the data +from stdin. Posting data from a file named \&'foobar' would thus be done with +--json @foobar and to instead read the data from stdin, use --json @-. diff --git a/docs/options-in-versions b/docs/options-in-versions index e75df6e06..5d242b8ff 100644 --- a/docs/options-in-versions +++ b/docs/options-in-versions @@ -99,6 +99,7 @@ --interface 7.3 --ipv4 (-4) 7.10.8 --ipv6 (-6) 7.10.8 +--json 7.82.0 --junk-session-cookies (-j) 7.9.7 --keepalive-time 7.18.0 --key 7.9.3 -- cgit v1.2.1