MCPcopy
hub / github.com/gobyexample-cn/gobyexample / guessContentType

Function guessContentType

tools/upload.go:22–33  ·  view source on GitHub ↗

guessContentType guesses the HTTP content type appropriate for the given filename.

(filename string)

Source from the content-addressed store, hash-verified

20// guessContentType guesses the HTTP content type appropriate for the given
21// filename.
22func 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
35func main() {
36 region := flag.String("region", "", "S3 region")

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected