guessContentType guesses the HTTP content type appropriate for the given filename.
(filename string)
| 20 | // guessContentType guesses the HTTP content type appropriate for the given |
| 21 | // filename. |
| 22 | func guessContentType(filename string) string { |
| 23 | switch filepath.Ext(filename) { |
| 24 | case ".ico": |
| 25 | return "image/x-icon" |
| 26 | case ".png": |
| 27 | return "image/png" |
| 28 | case ".css": |
| 29 | return "text/css" |
| 30 | default: |
| 31 | return "text/html" |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | func main() { |
| 36 | region := flag.String("region", "", "S3 region") |