首先,我搜索了这个问题,但找不到任何解决方案 .

我正在向Web服务发送POST请求 . 此Web服务返回响应,但我看到响应未完成 .

使用PostMan,我可以毫无问题地得到完整的回复但OKHttp削减了回应 .

public List<Product> getProducts(String token, long bill_acct_id, long customer_id, Context context) {
    if(token != null && !token.equals("")) {
        Gson gson = new Gson();
        List<Product> prods;
        Map<String, String> list_of_headers = new HashMap<>();
        list_of_headers.put("WSC-AUTH-TOKEN", token);
        list_of_headers.put("Accept", "application/json, text/plain, */*");
        list_of_headers.put("Content-Type", "application/json");
        Headers headers = Headers.of(list_of_headers);
        try {
            Response response = RequestSender.post2("URL", "{\"billingAccountId\":\""+bill_acct_id+"\", \"customerId\":\""+customer_id+"\"}", headers, context);
            int returnCode = response.code();
            ResponseBody body = response.body();
            Log.e("INFO", body.string());
            if (returnCode == 200) {
                prods = gson.fromJson(body.string(), new TypeToken<List<Product>>() {
                }.getType());

                return prods;
            }
        } catch (Exception ex) {
            Log.e("Error", ex.getMessage());
            ex.printStackTrace();
        }
    }
    return null;
}

响应:

  • 解决了 .

回复邮递员:

  • 解决了

有谁遇到过这个问题?我需要你的帮助 . 谢谢 .

**编辑:**实际上它已经完成了 . Log.e()和System.out.println();方法不显示完整的JSON .