Karate 创建多部分/混合请求

Karate 创建多部分/混合请求,karate,Karate,我有一个非常具体的案例,我想用空手道来测试 PUT https://test-api.com/endpoint Content-Type: multipart/mixed; boundary=BOUNDARY --BOUNDARY Content-Type: application/vnd.api+json {"type": "json-api-object"} --BOUNDARY Content-Disposition: attachment; name="fieldname"; file

我有一个非常具体的案例,我想用空手道来测试

PUT https://test-api.com/endpoint
Content-Type: multipart/mixed; boundary=BOUNDARY
--BOUNDARY
Content-Type: application/vnd.api+json

{"type": "json-api-object"}
--BOUNDARY
Content-Disposition: attachment; name="fieldname"; filename="filename.jpg"
Content-Type: image/jpeg
Content-Encoding: base64

<binary data>
--BOUNDARY--
PUThttps://test-api.com/endpoint
内容类型:多部分/混合;边界=边界
--边界
内容类型:application/vnd.api+json
{“类型”:“json api对象”}
--边界
内容处置:附件;name=“fieldname”;filename=“filename.jpg”
内容类型:图像/jpeg
内容编码:base64
--边界--
示例显示了多部分/混合请求,但没有显示如何在每个部分上设置内容类型头。我尝试使用
和多部分头…
,但没有正确解析


如果我能在你的帮助下解决这个问题,我会针对这些例子做一个PR,希望将来能帮助别人。

是的,这是我第一次看到每个部分都需要自定义内容类型。这需要对代码进行更改,所以是的


同时,您可以对正常请求进行处理。

我面临着类似的问题,但负载非常复杂。您是否即将解决此问题?