Skip to content
This repository was archived by the owner on Aug 19, 2019. It is now read-only.

Conversation

@bmoyles0117
Copy link
Contributor

No description provided.


std::string response = "unhealthy components:\n";
for (const auto& component : unhealthy_components) {
response.append(component + "\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use std::ostringstrean instead of std::string::append.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


conn->set_headers(std::map<std::string, std::string>({
{"Content-Type", "application/json"},
{"Content-Length", std::to_string(response.length())},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we use std::string::size everywhere else...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

@igorpeshansky igorpeshansky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

conn->set_status(HttpServer::connection::internal_server_error);

std::ostringstream response_stream;
response_stream << "unhealthy components:\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Optional] You can combine these:

    std::ostringstream response_stream("unhealthy components:\n");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks!

Copy link
Contributor

@igorpeshansky igorpeshansky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@igorpeshansky igorpeshansky merged commit d156d81 into master Jul 23, 2018
@igorpeshansky igorpeshansky deleted the bmoyles-set-content-length branch July 23, 2018 04:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants