memos/plugin/http-getter/util.go
2023-03-14 08:38:54 +08:00

16 lines
278 B
Go

package getter
import (
"mime"
"net/http"
)
func getMediatype(response *http.Response) (string, error) {
contentType := response.Header.Get("content-type")
mediatype, _, err := mime.ParseMediaType(contentType)
if err != nil {
return "", err
}
return mediatype, nil
}