diff --git a/exporters/elasticsearch/src/es_log_record_exporter.cc b/exporters/elasticsearch/src/es_log_record_exporter.cc index e58fb1dda4..3b3e8c4aeb 100644 --- a/exporters/elasticsearch/src/es_log_record_exporter.cc +++ b/exporters/elasticsearch/src/es_log_record_exporter.cc @@ -59,7 +59,7 @@ class ResponseHandler : public http_client::EventHandler // Store the body of the request body_ = std::string(response.GetBody().begin(), response.GetBody().end()); - if (response.GetStatusCode() != 200 && response.GetStatusCode() != 202) + if (!(response.GetStatusCode() >= 200 && response.GetStatusCode() <= 299)) { log_message = BuildResponseLogMessage(response, body_); diff --git a/exporters/otlp/src/otlp_http_client.cc b/exporters/otlp/src/otlp_http_client.cc index 6a1b89164e..8bada1e0e0 100644 --- a/exporters/otlp/src/otlp_http_client.cc +++ b/exporters/otlp/src/otlp_http_client.cc @@ -100,7 +100,7 @@ class ResponseHandler : public http_client::EventHandler // Store the body of the request body_ = std::string(response.GetBody().begin(), response.GetBody().end()); - if (response.GetStatusCode() != 200 && response.GetStatusCode() != 202) + if (!(response.GetStatusCode() >= 200 && response.GetStatusCode() <= 299)) { log_message = BuildResponseLogMessage(response, body_); diff --git a/exporters/zipkin/src/zipkin_exporter.cc b/exporters/zipkin/src/zipkin_exporter.cc index 97fdf4e63a..a8a97b58af 100644 --- a/exporters/zipkin/src/zipkin_exporter.cc +++ b/exporters/zipkin/src/zipkin_exporter.cc @@ -78,7 +78,7 @@ sdk::common::ExportResult ZipkinExporter::Export( http_client::Body body_v(body_s.begin(), body_s.end()); auto result = http_client_->PostNoSsl(url_parser_.url_, body_v, options_.headers); if (result && - (result.GetResponse().GetStatusCode() == 200 || result.GetResponse().GetStatusCode() == 202)) + (result.GetResponse().GetStatusCode() >= 200 && result.GetResponse().GetStatusCode() <= 299)) { return sdk::common::ExportResult::kSuccess; }