From acfd281f94c53c2b20ca9ed0ec48780719f25dca Mon Sep 17 00:00:00 2001 From: Sebastian Mellor Date: Fri, 17 Feb 2023 08:19:48 +0000 Subject: [PATCH] replace curl-7.82-only feature `--json` --- CHANGELOG.md | 3 +++ bs | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ba30c3f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## Pre-release + +* Fix: Add support for `curl` versions below 7.82 (0.0.3) diff --git a/bs b/bs index f15a359..ed8389a 100755 --- a/bs +++ b/bs @@ -4,8 +4,8 @@ trap "trap_error" TERM trap "trap_clean" EXIT export TOP_PID=$$ -version="0.0.2" -release="20220918" +version="0.0.3" +release="20230217" tmpdir=$(mktemp -d /tmp/bs.XXXXXX) @@ -475,13 +475,13 @@ crud () { echo "{$data,\"$content_type\":" > "$tmpfile" "$jq" "${jq_json_escape_options[@]}" . "$content" >> "$tmpfile" echo "}" >> "$tmpfile" - post $branch --json "@$tmpdir/data.json" + post $branch -H 'Content-Type: application/json' --data "@$tmpdir/data.json" unlink "$tmpfile" else if [ -n "$form" ]; then post $branch "${fdata[@]}" -F "$form" else - post $branch --json "{$data}" + post $branch -H 'Content-Type: application/json' --data "{$data}" fi fi ;; @@ -496,20 +496,20 @@ crud () { echo "{$data,\"$content_type\":" > "$tmpfile" "$jq" "${jq_json_escape_options[@]}" . "$content" >> "$tmpfile" echo "}" >> "$tmpfile" - put $branch "$id" --json "@$tmpdir/data.json" + put $branch "$id" -H 'Content-Type: application/json' --data "@$tmpdir/data.json" unlink "$tmpfile" else if [ -n "$form" ]; then put $branch "$id" "${fdata[@]}" -F "$form" else - put $branch "$id" --json "{$data}" + put $branch "$id" -H 'Content-Type: application/json' --data "{$data}" fi fi ;; delete) if [ -n "$data" ]; then - delete $branch "$id" --json "{$data}" + delete $branch "$id" -H 'Content-Type: application/json' --data "{$data}" else delete $branch "$id" fi