I am passing dynamic value to testing method and executing the curl request. There is an issue with $PARAMETERS.
When I execute the following method, I get error as below
Error:-
curl: option -F: requires parameter
curl: try 'curl --help' or 'curl --manual' for more information
Function:-
testing() {
local URL=$1
local HTTP_TYPE=$2
local PARAMETERS=$3
# store the whole response with the status at the and
HTTP_RESPONSE=$(curl -w "HTTPSTATUS:%{http_code}" -X $HTTP_TYPE $URL $PARAMETERS)
echo $HTTP_RESPONSE
}
URL='https://google.com'
HTTP_TYPE='POST'
PARAMETERS="-F 'name=test' -F 'query=testing'"
result=$(testing $URL $HTTP_TYPE $PARAMETERS)
FYI, above is a sample method and am using shell script. Kindly tell me how to solve this?