fix: scraping failed when Content-Type header is not set (#24135)
Co-authored-by: L1Cafe <L1Cafe@donotemail.me>pull/24163/head
parent
e1d0102a6f
commit
5a7ce078f5
|
@ -55,7 +55,9 @@ func (p *prometheusScraper) parse(r io.Reader, header http.Header, target influx
|
|||
now := time.Now()
|
||||
|
||||
mediatype, params, err := mime.ParseMediaType(header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
if err != nil && err.Error() == "mime: no media type" {
|
||||
mediatype = "text/plain"
|
||||
} else if err != nil {
|
||||
return collected, err
|
||||
}
|
||||
// Prepare output
|
||||
|
|
Loading…
Reference in New Issue