[英]Linux CURL how to POST file and data url encoded same time?
I have a problem to send a POST request with a text file and some key=value (value contains special characters and it needs to be encoded, eg: query=select c + a % b). 我在发送带有文本文件和某些键=值的POST请求时遇到问题(值包含特殊字符,需要对其进行编码,例如:query = select c + a%b)。
I've tried like this and it returns error Warning: You can only select one HTTP request!
我已经尝试过这种方法,但它会返回错误Warning: You can only select one HTTP request!
curl -F "file=@path_to_text_file"
--data-urlencode "query=select c + a % b" "http://localhost:8082/app"
remove --data-urlencode
then it can run but the value of query is not encoded. 删除--data-urlencode
即可运行,但查询值未编码。
I prefer to not need to encode query manually. 我宁愿不需要手动编码查询。
这将进行上传,然后发送发布请求
curl -F "file=@path_to_text_file" "http://localhost:8082/app" --next --data-urlencode "query=select c + a % b" "http://localhost:8082/app"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.