Source file src/net/http/sniff.go
1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package http 6 7 import "net/http/internal" 8 9 // DetectContentType implements the algorithm described 10 // at https://mimesniff.spec.whatwg.org/ to determine the 11 // Content-Type of the given data. It considers at most the 12 // first 512 bytes of data. DetectContentType always returns 13 // a valid MIME type: if it cannot determine a more specific one, it 14 // returns "application/octet-stream". 15 func DetectContentType(data []byte) string { 16 return internal.DetectContentType(data) 17 } 18