while true;
do (
echo -e 'HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nAccess-Control-Allow-Origin:*\r\n';
echo -e "{\"code\":\"0\",\"data\":{\"success\":true}}\n"
) | nc -lp 9527; done
echo -e 支持转移符比如'\r\n'
Access-Control-Allow-Origin说本服务支持跨域
echo 会输出换行,所以最后的http报文为
HTTP/1.1 200 OK
Content-Type: application/json
Access-Control-Allow-Origin:*
{"data":{"success":true}}
Posted in: Linux
Comments are closed.