我正在尝试通过 AppEngine 发送压缩文件,我的功能是
func handleWebGLRequest(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
blobKey, err := blobstore.BlobKeyForFile(c, "/gs/<path>/WebGL.datagz")
if err != nil {
fmt.Fprintf(w, "Problem: cannot find WebGL.data")
return
}
w.Header().Set("Content-Type", "blah/blah/application/octet-stream")
w.Header().Set("Content-Encoding", "gzip")
blobstore.Send(w, blobKey)
}
文件已发送,内容类型正确显示在“blah/blah/application/octet-stream”的响应标头中,但 Content-Encoding 永远不会出现在响应标头中,这(我认为)是其他问题的原因我有。
有谁知道为什么它不起作用?
(以防万一 - 我正在使用 chrome 检查器查看响应标头,在这里,源未解析
HTTP/1.1 200 OK 内容类型:blah/blah/application/octet-stream 传输编码:chunked 日期:2015 年 4 月 28 日星期二 06:50:09 GMT 服务器:Google 前端替代协议:80:quic,p= 1)
非常感激