Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lmj010308 fixed /http/server/HttpResponseWriter.cpp 使用SSEvent时,当event 为空指针时,不加event参数 #542

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lmj010308
Copy link

int HttpResponseWriter::SSEvent(const std::string& data, const char* event /* = "message" */) {
if (state == SEND_BEGIN) {
EndHeaders("Content-Type", "text/event-stream");
}
std::string msg="";
if(event != nullptr){
msg = "event: "; msg += event; msg += "\n";
}
msg += "data: "; msg += data; msg += "\n\n";
state = SEND_BODY;
return write(msg);
}

@@ -67,8 +67,10 @@ int HttpResponseWriter::SSEvent(const std::string& data, const char* event /* =
if (state == SEND_BEGIN) {
EndHeaders("Content-Type", "text/event-stream");
}
std::string msg;
msg = "event: "; msg += event; msg += "\n";
std::string msg="";
Copy link
Owner

Choose a reason for hiding this comment

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

注意下代码风格,空格、缩进,下面几行也是

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants