空手道多部分文件上传从mulesoft获取错误

发布于 2025-01-30 06:21:47 字数 2188 浏览 1 评论 0原文

mulesoft被拒绝一个文件上传: “无法从form-data获取名称” 根据此链接: mulesoft support 他们建议命名约定 如下:内容分配,而不是作为内容键入发送的内容。

功能:

        Given url 'https:someurlpath'
        And header Authorization = 'Basic ' + 'feefff'
        And header Content-Type = 'multipart/form-data'
        And header Accept-Encoding = 'gzip, deflate, br'
        And multipart field  callingApplicationName = 'Karate'
        And multipart file  binaryContent =  { read: 'response.tif', filename: 'response.tif', contentType: 'image/tiff' }
        And multipart field  properties = '[{"displayName":"SR Number","value":["1234","12345"]},{"displayName":"Document Type","value":"CLAI"},{"displayName":"Ingestion Source","value":"FILENETTOOLS"},{"displayName":"Received Date","value":"2022-01-14T00:52:50.837650Z"},{"displayName":"Pages","value":"0"}]'
        When method Post
        Then status 200
        And print response
        And match response.status == 'ACTIVE'

这是请求:

1 > POST https://api.maha.com/documents-process-api/v1/documentC/specialR/documents/
1 > Authorization: Basic foooooooobooooooo
1 > Content-Type: multipart/form-data; boundary=231ef49a739286f9
1 > Accept-Encoding: gzip, deflate, br
1 > Content-Length: 214420
1 > Host: api.maha.com
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/14.0.2)

content-disposition: form-data; name="callingApplicationName"; filename=""
content-type: text/plain; charset=UTF-8
content-length: 6
Completed: true
IsInMemory: true

Mixed: content-disposition: form-data; name="binaryContent"; filename="response.tif"
content-type: image/tiff; charset=UTF-8
content-length: 213642
Completed: true
IsInMemory: false
RealFile: /Users/req/workspace/hlx/sasquatch-automated-tests/src/test/groovy/com/maha/gpa/document/storage/service/response.tif DefaultDeleteAfter: true

content-disposition: form-data; name="properties"; filename=""
content-type: text/plain; charset=UTF-8
content-length: 278
Completed: true
IsInMemory: true

Mulesoft is rejected a file upload saying:
"Unable to get name from form-data"
According to this link: MuleSoft Support they suggest naming convention of
following: Content-Disposition, instead of what is being sent as content-disposition.

Feature:

        Given url 'https:someurlpath'
        And header Authorization = 'Basic ' + 'feefff'
        And header Content-Type = 'multipart/form-data'
        And header Accept-Encoding = 'gzip, deflate, br'
        And multipart field  callingApplicationName = 'Karate'
        And multipart file  binaryContent =  { read: 'response.tif', filename: 'response.tif', contentType: 'image/tiff' }
        And multipart field  properties = '[{"displayName":"SR Number","value":["1234","12345"]},{"displayName":"Document Type","value":"CLAI"},{"displayName":"Ingestion Source","value":"FILENETTOOLS"},{"displayName":"Received Date","value":"2022-01-14T00:52:50.837650Z"},{"displayName":"Pages","value":"0"}]'
        When method Post
        Then status 200
        And print response
        And match response.status == 'ACTIVE'

Here is the request:

1 > POST https://api.maha.com/documents-process-api/v1/documentC/specialR/documents/
1 > Authorization: Basic foooooooobooooooo
1 > Content-Type: multipart/form-data; boundary=231ef49a739286f9
1 > Accept-Encoding: gzip, deflate, br
1 > Content-Length: 214420
1 > Host: api.maha.com
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/14.0.2)

content-disposition: form-data; name="callingApplicationName"; filename=""
content-type: text/plain; charset=UTF-8
content-length: 6
Completed: true
IsInMemory: true

Mixed: content-disposition: form-data; name="binaryContent"; filename="response.tif"
content-type: image/tiff; charset=UTF-8
content-length: 213642
Completed: true
IsInMemory: false
RealFile: /Users/req/workspace/hlx/sasquatch-automated-tests/src/test/groovy/com/maha/gpa/document/storage/service/response.tif DefaultDeleteAfter: true

content-disposition: form-data; name="properties"; filename=""
content-type: text/plain; charset=UTF-8
content-length: 278
Completed: true
IsInMemory: true

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柳絮泡泡 2025-02-06 06:21:47

是的,这是解决方法的已知问题,请参阅此线程: https:// /karatelabs/karate/essugy/1647

与此同时,您最欢迎您为空手道贡献代码以解决此问题:)

Yes this is a known issue with a workaround, refer this thread please: https://github.com/karatelabs/karate/issues/1647

Meanwhile you are most welcome to contribute code to Karate to fix this :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文