oldPath="ABC+ABC"
curl -G --data--urlencode "oldPath=$oldPath" www.abc.com
传过去报错 oldPath "ABC ABC" 不存在
"+" 变成了空格
怎么传 ABC+ABC 过去呢?
1
tsanie 2021-11-12 14:02:10 +08:00
--data--urlencode 表示你的 data 是 encoded 后的,去掉这个参数使用--data ,或者--data-urlencode "oldPath=ABC%2BABC"
|
2
honjow 2021-11-12 14:06:35 +08:00 via iPhone
去查下 urlencode 是啥
|
4
0608516518 2021-11-12 16:48:43 +08:00
请 post 到 http://httpbin.org/post ,就可以看到服务器视角得到了什么
|
5
toyst OP ```
* Trying 127.0.0.1:12345... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 12345 (#0) > POST /api/v2/torrents/renameFile HTTP/1.1 > Host: 127.0.0.1:12345 > User-Agent: curl/7.68.0 > Accept: */* > Cookie: SID=37qv44bvLPGK+9QMl5rmv/aNPNnaTqSYa > Content-Length: 307 > Content-Type: application/x-www-form-urlencoded > * upload completely sent off: 307 out of 307 bytes * Mark bundle as not supporting multiuse < HTTP/1.1 409 Conflict < connection: keep-alive < content-length: 159 < content-security-policy: default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src 'self' 'unsafe-inline'; object-src 'none'; form-action 'self'; < content-type: text/plain; charset=UTF-8 < date: Fri, 12 Nov 2021 08:50:10 GMT < referrer-policy: same-origin < x-content-type-options: nosniff < x-xss-protection: 1; mode=block < * Connection #0 to host 127.0.0.1 left intact ``` 这是 -v 详细输出 |
6
msg7086 2021-11-14 04:06:28 +08:00 via Android
+ 就是空格。
%2B 才是 +。 |