groovy - 如何使用 SOAPUI 解压缩 GET 响应
问题描述
我收到来自服务器的压缩响应。
使用 CURL,| gunzip
我能够获得解压缩的内容响应,但我不想使用 CURL 并直接通过 SOAPUI、标题或脚本解压缩它。
我试着写一些类似的东西:
def responseBody=testRunner.testCase.getTestStepByName("getZIp").httpRequest.response.responseContent;
InputStream ins = new ByteArrayInputStream(responseBody.getBytes())
log.info responseBody
def outFile = new FileOutputStream(new File('/users/trythis.zip'))
if (ins) {
com.eviware.soapui.support.Tools.writeAll(outFile, ins )
}
ins.close()
outFile.close()
但数据仍然被压缩。
解决方案
直截了当的东西,例如:
InputStream ins = new ByteArrayInputStream(responseBody.getBytes())
def outFile = new File('/users/trythis.txt')
new GZIPInputStream( ins ).withReader{ outFile << it }
推荐阅读
- json - 意外字符('-'(代码 45)):soapUI 上的预期空间分隔根级值错误
- python - VSCode Jupyter 在使用 Sympy + IPython.display 时挂断
- node.js - mongodb 中的 Decimal128 格式值有时会给出 NaN 值
- android - 无法在通知上获取通知图标 使用 FCM 消息在 Android Flutter 中弹出
- reactjs - 打字稿错误类型“未定义”不能用作索引类型
- nginx - 以桥接模式通过安装了 Virtual Box 的 Minikube 公开服务器 Nginx
- javascript - Div 上的文本颜色“差异”
- flutter - 颤动的 camera_deep_ar 依赖项无法正常工作
- python - Pandas to_dict 类似列表的输出
- python - 如何在没有 UI 的情况下生成 locust html 文件?