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" "$@" curl -s --compressed -X POST -H "Authorization: Bearer $auth" "$@"
} }
put_request()
{
curl -s --compressed -X PUT -H "Authorization: Bearer $auth" "$@"
}
echo '+Authorized account+' echo '+Authorized account+'
export default_curl_opt export default_curl_opt
export post_request export post_request
export put_request
else else
default_curl_opt() default_curl_opt()
{ {
@ -908,7 +913,7 @@ custom_manual_api_request()
{ {
while true; do while true; do
echo 'Select request method:' echo 'Select request method:'
method=$(echo 'get\npost' | fzy) method=$(echo 'get\npost\nput' | fzy)
echo 'Input api request: api/v1/...' echo 'Input api request: api/v1/...'
case $method in case $method in
'get') 'get')
@ -917,7 +922,15 @@ custom_manual_api_request()
;; ;;
'post') 'post')
read raw_api 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 esac
echo "Done, exit? (y/N)" echo "Done, exit? (y/N)"