Skip to content

Commit 3d5a4d6

Browse files
committed
refactor
1 parent 7a25427 commit 3d5a4d6

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/http/http_server.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ struct http_response
8282
as_bad_request(fmt::format("{} should not be empty", key));
8383
}
8484

85-
void set_json_body(std::string str)
85+
void as_ok_json(std::string str)
8686
{
8787
body = std::move(str);
88+
status_code = http_status_code::kOk;
8889
content_type = "application/json; charset=utf-8";
8990
}
9091

src/replica/replica_http_service.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ void replica_http_service::query_replica_status_handler(const http_request &req,
120120
// Serialize the replica status into JSON format in preparation for responding to
121121
// the HTTP request.
122122
const nlohmann::json json{{"status", status}};
123-
resp.status_code = http_status_code::kOk;
124-
resp.set_json_body(json.dump());
123+
resp.as_ok_json(json.dump());
125124
}
126125

127126
void replica_http_service::query_app_data_version_handler(const http_request &req,

0 commit comments

Comments
 (0)