httpRequest httpMode: 'POST',
contentType: 'APPLICATION_OCTETSTREAM',
formData: [[body: '''{
"project_id" : "project",
"token" : "1111"
}''',
contentType: 'text/plain', fileName: 'project.exe', name: 'file',
uploadFile: 'bin/windows_amd64/111.txt']],
responseHandle: 'STRING', timeout: null,
url: 'http://xxx/trade/deploy/upload',
validResponseCodes: '200,404', validResponseContent: 'token',
consoleLogResponseBody: true
project: string
token: string
file: file
formData: [
[contentType: 'multipart/form-data', name: 'token', body: '1111'],
[contentType: 'multipart/form-data', name: 'project_id', body: '${project_id}'],
[contentType: 'text/plain', name: 'file', fileName: '${project_id}.exe',
uploadFile: 'bin/windows_amd64/111.txt']]
我尝试把其他表单参数放到地址栏后面 http://xxx/trade/deploy/upload?token=111,结果不报 token 找不到了,但是又有新的问题,服务端接收文件为 null...... 文件在目录下是存在的,路径也没错,如果路径写错会报找不到文件
经调试multipartName属性为接口接收文件的参数名,配对了就可以了,其他参数拼在地址栏后面,就不需要设置formdata了