Added method put; fix input raw_api and data

This commit is contained in:
localhost_frssoft 2022-08-02 20:26:40 +03:00
parent b1ca069656
commit 5eb9853a1c

View file

@ -60,9 +60,14 @@ make_login()
{
curl -s --compressed -X POST -H "Authorization: Bearer $auth" "$@"
}
put_request()
{
curl -s --compressed -X PUT -H "Authorization: Bearer $auth" "$@"
}
echo '+Authorized account+'
export default_curl_opt
export post_request
export put_request
else
default_curl_opt()
{
@ -908,7 +913,7 @@ custom_manual_api_request()
{
while true; do
echo 'Select request method:'
method=$(echo 'get\npost' | fzy)
method=$(echo 'get\npost\nput' | fzy)
echo 'Input api request: api/v1/...'
case $method in
'get')
@ -917,7 +922,15 @@ custom_manual_api_request()
;;
'post')
read raw_api
post_request --url "https://$instance/$raw_api" | jj -p
echo 'input curl data flags: --data-urlencode "example=example"'
read flags
post_request $flags --url "https://$instance/$raw_api" | jj -p
;;
'put')
read raw_api
echo 'input curl data flags: --data-urlencode "example=example"'
read flags
put_request $flags --url "https://$instance/$raw_api" | jj -p
;;
esac
echo "Done, exit? (y/N)"