mirror of https://github.com/usememos/memos
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
282 B
Go
16 lines
282 B
Go
10 months ago
|
package httpgetter
|
||
2 years ago
|
|
||
|
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
|
||
|
}
|