Merge pull request #10560 from Icinga/influxdb-mist

Don't expect `Contet-Type` header to exactly match `application/json`
This commit is contained in:
Julian Brost 2026-03-03 11:28:45 +01:00 committed by GitHub
commit 851440a583
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -494,31 +494,8 @@ void InfluxdbCommonWriter::FlushWQ()
auto& response (parser.get());
if (response.result() != http::status::no_content) {
Log(LogWarning, GetReflectionType()->GetName())
<< "Unexpected response code: " << response.result();
auto& contentType (response[http::field::content_type]);
if (contentType != "application/json") {
Log(LogWarning, GetReflectionType()->GetName())
<< "Unexpected Content-Type: " << contentType;
return;
}
Dictionary::Ptr jsonResponse;
auto& body (response.body());
try {
jsonResponse = JsonDecode(body);
} catch (...) {
Log(LogWarning, GetReflectionType()->GetName())
<< "Unable to parse JSON response:\n" << body;
return;
}
String error = jsonResponse->Get("error");
Log(LogCritical, GetReflectionType()->GetName())
<< "InfluxDB error message:\n" << error;
<< "Unexpected response code: " << response.result() << ", InfluxDB error message:\n" << response.body();
}
}