Open myangelct1984 opened 2 years ago
找到这个方法com.alibaba.jvm.sandbox.repater.plugin.http.HttpStandaloneListener#onResponse, 修改成
@Override public void onResponse(WrapperRequest request, WrapperTransModel wtm) { HttpInvocation invocation = (HttpInvocation) RecordCache.getInvocation(request.hashCode()); if (invocation == null || invocation.isAsync()) { return; } try { wtm.setResponse(new String(wtm.copier.getResponseData())); } catch (Exception e) { LogUtil.error("error occurred when get response,message = {}", e.getMessage()); } onFinish(invocation, wtm); }
源码之前是
wtm.setResponse(new String(wtm.copier.getResponseData(), wtm.copier.getCharacterEncoding()));
原作者在装配结果是,加上了字符编码。去除这个编码,应该可以。
我也遇到过这个问题,应该还是中文的问题,试了试Accept-Language是英文的,就可以用
我是这样处理 wtm.setResponse(new String(wtm.copier.getResponseData())); 给了不同的方式去处理
如果录制的请求里header有 "Accept" : "application/json, text/plain, /", "Accept-Encoding" : "gzip, deflate, br", "Accept-Language" : "zh-CN,zh;q=0.9", "Connection" : "close", 请求后返回值回出现乱码
"��VJI,IT���VK�)MU�Rz6g����Ow4+�(e�VY�� d�n߄k�&�dG��]�a��h��wO~6w>�d��/�W��t �jcu���SRA����!�ײ�