如何在Azure Functions(v2)上启用GZIP压缩?

时间:2018-03-17 16:33:50

标签: azure azure-functions

如何在Azure Functions(v2)上启用GZIP压缩?

我和邮递员核实过它没有显示GZIP

POST /api/values HTTP/1.1
Host: HOSTNAMEHERE.azurewebsites.net
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: e2c3967b-f562-df35-a3d1-01bd56cb4b76

1 个答案:

答案 0 :(得分:1)

这是我的错误。

当达到该功能时,GZip似乎默认配置为ON:)

在我的情况下,我正在使用本地函数,它没有Gzip:

local

Content-Type →application/json; charset=utf-8
Date →Mon, 19 Mar 2018 00:55:06 GMT
Server →Kestrel
Transfer-Encoding →chunked

我注意到,当我在Azure上调用正确的URL时,它就会出现:

Content-Encoding →gzip
Content-Type →application/json; charset=utf-8
Date →Sat, 17 Mar 2018 17:29:46 GMT
Server →Kestrel
Transfer-Encoding →chunked
Vary →Accept-Encoding
X-Powered-By →ASP.NET