github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/net/http/sniff.go (about)

     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  // DetectContentTypeは、指定されたデータのContent-Typeを決定するために
     8  // https://mimesniff.spec.whatwg.org/ で説明されているアルゴリズムを実装します。
     9  // データの最初の512バイトまでしか考慮しません。
    10  // DetectContentTypeは常に有効なMIMEタイプを返します。
    11  // より具体的なMIMEタイプを決定できない場合は、"application/octet-stream"を返します。
    12  func DetectContentType(data []byte) string