Skip to content

Commit

Permalink
replace curl-7.82-only feature --json
Browse files Browse the repository at this point in the history
  • Loading branch information
sjimellor-jr committed Feb 17, 2023
1 parent 5c08650 commit acfd281
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Pre-release

* Fix: Add support for `curl` versions below 7.82 (0.0.3)
14 changes: 7 additions & 7 deletions bs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
;;
Expand All @@ -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
Expand Down

0 comments on commit acfd281

Please sign in to comment.