【发布时间】:2017-03-17 21:54:49
【问题描述】:
我正在使用仅适用于 GZIP 压缩的服务。我添加了接受标头并且服务可以正常工作,但是 RESTClient 无法正确解析内容。
我的代码:
def client = new RESTClient('https://rest-service-gziped.com')
def postBody = [ somekey: "somevalue" ]
def response = client.post(
path: "/some-endpoint",
body: postBody,
requestContentType : ContentType.JSON,
headers: ["Accept-Encoding": "gzip"]
)
错误信息是
Mar 17, 2017 5:48:03 PM groovyx.net.http.RESTClient handleResponse
WARNING: Error parsing 'application/json; charset=utf-8' response
groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object
【问题讨论】:
标签: java groovy httpbuilder