mirror of
https://github.com/usememos/memos.git
synced 2024-11-17 04:07:30 +08:00
15 lines
282 B
Go
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
|
|
}
|