这有效:
curl -k -d 'VARTEST=vartest2&TEXTPARAM=text1%0Atext2&COMMENT=abc22' http://localhost:8080/job/TEST1/buildWithParameters?delay=0sec
curl -X POST -k 'http://localhost:8080/job/TEST1/buildWithParameters?delay=0sec&VARTEST=vartest2&TEXTPARAM=text1%0Atext2&COMMENT=abc22'
我希望能够将 -d
的参数写入文件并像这样运行命令行
curl -k -d @persargfile 'http://localhost:8080/job/TEST1/buildWithParameters?delay=0sec' -o abc.html
或者像这样
curl -k --data-urlencode @persargfile 'http://localhost:8080/job/TEST1/buildWithParameters?delay=0sec' -o abc.html
问题:
persargfile 的格式应该是什么?
最佳答案
作为man page状态,有多种可用格式:
- ascii(--data-ascii)
- urlencoded(--data-urlencoded)
- 二进制(--data-binary)
您的应用程序似乎需要 ascii
选项。这意味着您的文件应包含:
VARTEST=vartest2&TEXTPARAM=text1%0Atext2&COMMENT=abc22
关于linux - 作为输入发送到curl --data 和--data-encode 的文件需要写入的格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18836680/