Karate 空手道api:必需的请求部分';文件';不在场
当我尝试使用空手道框架上传图像时,我得到了一个例外Karate 空手道api:必需的请求部分';文件';不在场,karate,Karate,当我尝试使用空手道框架上传图像时,我得到了一个例外 { "message":"Required request part 'file' is not present", "code":500, "className":"org.springframework.web.multipart.support.MissingServletRequestPartException" } 空手道规则 Scenario: Adding image Given path Endp
{
"message":"Required request part 'file' is not present",
"code":500,
"className":"org.springframework.web.multipart.support.MissingServletRequestPartException"
}
空手道规则
Scenario: Adding image
Given path Endpoints.upload_file
And multipart file myFile = { read: 'karate-logo.jpg', filename: karate-logo.jpg', contentType: 'image/jpg' }
And multipart field message = 'image test'
When method post
当我尝试使用postman时,API工作得很好。
只需在正文部分发送文件,表单数据键为“file”,值为要上载的图像。此处的“key”是上载字段的名称。看起来您的服务器需要文件
。请将myFile
重命名为file
,它应该可以工作