memos/plugin/httpgetter/util.go
2024-05-06 07:18:54 +08:00

15 lines
282 B
Go

package httpgetter
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
}