mirror of
https://github.com/usememos/memos.git
synced 2024-12-22 18:51:31 +03:00
16 lines
278 B
Go
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
|
||
|
}
|