在TRESTResponse中自动解码GZIP? [英] Automatically Decode GZIP In TRESTResponse?

查看:81
本文介绍了在TRESTResponse中自动解码GZIP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎无法为TRESTClient分配压缩器或拦截。

It doesn't seem possible to assign a compressor or intercept to the TRESTClient.

如果我将TRESTRequest.AcceptEncoding设置为 gzip,放气,则我会从支持gzip的服务器收到gzip编码的响应。

If I set TRESTRequest.AcceptEncoding to 'gzip, deflate' I receive a gzip encoded response from a server that supports gzip.

但是,在TIdHTTP中,我认为它将自动对其进行解码。在TRESTResponse.Content中,它仍然是gzip编码的,我必须使用TIdCompressorZlib.DecompressGZipStream()手动对其进行解码。 TRESTResponse是否可以自动解码?

However, in TIdHTTP I think it would automatically decode it. In TRESTResponse.Content it is still gzip encoded and I have to decode it manually with TIdCompressorZlib.DecompressGZipStream(). Is there a way for TRESTResponse to decode it automatically?

推荐答案

如果您设置属性 TCustomRESTRequest,则它是本地的。 gzip,缩小 值的AcceptEncoding

It's native if you set property TCustomRESTRequest.AcceptEncoding with "gzip, deflate" value.

这篇关于在TRESTResponse中自动解码GZIP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆