fix: resolve http non encode attachment filename (#975)

This commit is contained in:
Levi authored and GitHub committed 2025-04-05 22:37:19 +08:00
1 parent 50bc9ab129
commit cd5fd45667
4 files changed
+39 -2

No files matched your search

+11
View File
@@ -102,6 +102,17 @@ func StartTestCustomServer() net.Listener {
defer file.Close()
io.Copy(writer, file)
})
mux.HandleFunc("/no-encode", func(writer http.ResponseWriter, request *http.Request) {
writer.Header().Set("Content-Disposition", "attachment; filename=测试.zip")
writer.Header().Set("Content-Type", "application/octet-stream")
writer.Header().Set("Content-Length", fmt.Sprintf("%d", BuildSize))
file, err := os.Open(BuildFile)
if err != nil {
panic(err)
}
defer file.Close()
io.Copy(writer, file)
})
return mux
})
}