空手道 netty 服务器 - 如何发送 PDF/ZIP 文件作为 netty 服务器响应?

karate netty server - How to send PDF/ZIP files as a netty server response?

如何发送 PDF/ZIP 文件作为网络服务器响应? - 我们需要模拟语句生成,其中 PDF 文件需要作为 API 响应发送。

应该很简单,只需将 response 设置为 byte-array,设置正确的 Content-Type header,空手道应该完成剩下的工作:

Scenario: pathMatches('/v1/binary/download')
    * def responseHeaders = { 'Content-Type': 'application/octet-stream' }
    * def Utils = Java.type('com.myco.Utils')
    * def response = Utils.getPdfAsByteArray()

如果您发现问题,请尝试使用测试版 0.9.0.RC3 并告诉我。