#/bin/sh post_json() { response=`curl "${address}${url}" -X $request --connect-timeout 15 -m 20 --header 'Content-Type: application/json' -d "${data}" -o /dev/null -s -w %{http_code}` if [ $response != '200' ];then exit 3 fi } post_jsonstring() { response=`curl "${address}${url}" -X $request --connect-timeout 15 -m 20 --header 'Content-Type: application/x-www-form-urlencoded' -d "jsonSting=${data}" -o /dev/null -s -w %{http_code}` if [ $response != '200' ];then exit 3 fi } if [ -n "$SERVER_PORT" ];then port="$SERVER_PORT" elif [ -n "$PORT_DOCKER" ];then port="$PORT_DOCKER" fi address="http://127.0.0.1:${port}" request='POST' type='json' url="/reportOutlines/enums/reportState" data='{}' # address="http://127.0.0.1:${port}" # request='POST' # type='jsonstring' # url="/Spring/MVC/entrance/unifier/getPersonByUserNameService" # data='{"user_id":"","pd":"","person_id":"","groupCode":"BR","puser":{"userId":"","loginDevice":"PC","pd":""},"loginName":"PERSAGYADMIN","loginDevice":"PC","isAdminLogin":true}' if [ "$type" = "json" ];then post_json elif [ "$type" = "jsonstring" ];then post_jsonstring fi