Created
January 31, 2015 03:15
-
-
Save bliaxiong/c91d3ade6428d0549909 to your computer and use it in GitHub Desktop.
Simple golang server to serve a zip file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net/http" | |
) | |
func main() { | |
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | |
w.Header().Set("Content-Type", "applicaiton/zip") | |
w.Header().Set("Content-Disposition", "attachment; filename='file.html.zip'") | |
http.ServeFile(w, r, "/Users/bxiong/go/src/file_server/file.html.zip") | |
}) | |
http.ListenAndServe(":8080", nil) | |
} |
Typo in Type. Should be "application/zip"
There is a Typo in Content-Type header. It should be "application/zip" instead of "applicaiton/zip".
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Type "applicaiton/zip"