oceanbase/unittest/libobcdc/fake_config_server
wangzelin.wzl 93a1074b0c patch 4.0
2022-10-24 17:57:12 +08:00

13 lines
401 B
Bash
Executable File

#!/bin/bash
port=${1:-6789}
wrap_json='{"Message": "successful", "Success": true, "Code": 200, "Data":'
json=''
while content="$(printf "HTTP/1.1 200 OK\r\nContent-Length: %d\r\n\r\n%s" ${#json} "$json" | nc -l $port)" ; do
if echo "$content" | grep -q '^POST' && echo "$content" | tail -n 1 | grep -q '^{' ; then
json="$wrap_json$(echo "$content" | tail -n 1)}"
# echo "$json"
fi
done