use of com.xiaoyunchengzhu.httpapi.net.HttpHeader in project HttpApiDemo by xiaoyunchengzhu.
the class OkhttpCallbackAdapter method onResponse.
@Override
public void onResponse(Call call, final Response response) {
HttpResult httpResult = new HttpResult();
httpResult.setInputStream(response.body().byteStream());
httpResult.setContentLength(response.body().contentLength());
HttpHeader httpHeader = new HttpHeader();
Headers headers = response.headers();
for (String name : headers.names()) {
httpHeader.put(name, headers.get(name));
}
httpResult.setHttpHeader(httpHeader);
httpResult.setProtocol(response.protocol().name());
httpResult.setResponseCode(response.code());
httpResult.setUrl(api.getUrl());
callBackResult.success(api, httpResult);
}
Aggregations