memos/plugin/httpgetter/util.go

16 lines
282 B
Go
Raw Normal View History

2024-05-06 07:18:54 +08:00
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
}