mirror of
https://github.com/Icinga/icinga2.git
synced 2026-06-14 19:20:10 -04:00
Merge pull request #10560 from Icinga/influxdb-mist
Don't expect `Contet-Type` header to exactly match `application/json`
This commit is contained in:
commit
851440a583
1 changed files with 1 additions and 24 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue