我想要存储从GET请求获取的响应的MIME类型。我使用了
DetectContentType
函数,但它会为js和css资源都返回text/plain; charset=utf-8
。我需要区分每个URL的文件类型,而我正依赖于MIME类型来实现这一点。response, error := http.Get(url)
if error == nil {
contentType := response.Header.Get("Content-Type")
// ...
}
只给我内容类型。