diff --git a/frameworks/drogon/main.cc b/frameworks/drogon/main.cc index b90ee5ba..fefda789 100644 --- a/frameworks/drogon/main.cc +++ b/frameworks/drogon/main.cc @@ -19,7 +19,6 @@ struct DataItem { bool active; std::vector tags; Rating rating; - double total; }; static std::vector dataset; @@ -88,7 +87,6 @@ static void loadDataset() for (const auto &t : d["tags"]) item.tags.push_back(t.asString()); item.rating.score = d["rating"]["score"].asDouble(); item.rating.count = d["rating"]["count"].asInt64(); - item.total = std::round(item.price * item.quantity * 100.0) / 100.0; dataset.push_back(std::move(item)); } } @@ -204,7 +202,7 @@ class BenchmarkCtrl : public drogon::HttpController rating["score"] = d.rating.score; rating["count"] = static_cast(d.rating.count); item["rating"] = std::move(rating); - item["total"] = d.total; + item["total"] = std::round(d.price * d.quantity * 100.0) / 100.0; items.append(std::move(item)); } respJson["items"] = std::move(items); @@ -213,7 +211,7 @@ class BenchmarkCtrl : public drogon::HttpController wb["indentation"] = ""; auto resp = HttpResponse::newHttpResponse(); resp->setBody(Json::writeString(wb, respJson)); - resp->setContentTypeCode(CT_APPLICATION_JSON); + resp->setContentTypeString("application/json"); callback(resp); } else { auto resp = HttpResponse::newHttpResponse(); @@ -229,7 +227,7 @@ class BenchmarkCtrl : public drogon::HttpController if (!json_large_response.empty()) { auto resp = HttpResponse::newHttpResponse(); resp->setBody(json_large_response); - resp->setContentTypeCode(CT_APPLICATION_JSON); + resp->setContentTypeString("application/json"); callback(resp); } else { auto resp = HttpResponse::newHttpResponse(); @@ -280,7 +278,7 @@ class BenchmarkCtrl : public drogon::HttpController if (!db_available || !getDb() || !tl_stmt) { auto resp = HttpResponse::newHttpResponse(); resp->setBody("{\"items\":[],\"count\":0}"); - resp->setContentTypeCode(CT_APPLICATION_JSON); + resp->setContentTypeString("application/json"); callback(resp); return; } @@ -321,7 +319,7 @@ class BenchmarkCtrl : public drogon::HttpController wb["indentation"] = ""; auto resp = HttpResponse::newHttpResponse(); resp->setBody(Json::writeString(wb, respJson)); - resp->setContentTypeCode(CT_APPLICATION_JSON); + resp->setContentTypeString("application/json"); callback(resp); } @@ -333,7 +331,7 @@ class BenchmarkCtrl : public drogon::HttpController if (it != static_files.end()) { auto resp = HttpResponse::newHttpResponse(); resp->setBody(it->second.data); - resp->addHeader("Content-Type", it->second.content_type); + resp->setContentTypeString(it->second.content_type); callback(resp); } else { auto resp = HttpResponse::newHttpResponse(); diff --git a/frameworks/drogon/meta.json b/frameworks/drogon/meta.json index e3cac843..472363fd 100644 --- a/frameworks/drogon/meta.json +++ b/frameworks/drogon/meta.json @@ -13,7 +13,6 @@ "limited-conn", "json", "upload", - "compression", "mixed", "baseline-h2", "static-h2"