Skip to content

Commit b4cacee

Browse files
author
duzhongwei
committed
fix bug of used after move
1 parent d8f0113 commit b4cacee

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

include/brynet/net/http/HttpFormat.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ class HttpRequest final
8383

8484
void setBody(const std::string& body)
8585
{
86-
mBody = body;
8786
addHeadValue("Content-Length", std::to_string(body.size()));
87+
mBody = body;
8888
}
8989

9090
void setBody(std::string&& body)
9191
{
92-
mBody = std::move(body);
9392
addHeadValue("Content-Length", std::to_string(body.size()));
93+
mBody = std::move(body);
9494
}
9595

9696
void addHeadValue(const std::string& field,
@@ -180,14 +180,14 @@ class HttpResponse final
180180

181181
void setBody(const std::string& body)
182182
{
183-
mBody = body;
184183
addHeadValue("Content-Length", std::to_string(body.size()));
184+
mBody = body;
185185
}
186186

187187
void setBody(std::string&& body)
188188
{
189-
mBody = std::move(body);
190189
addHeadValue("Content-Length", std::to_string(body.size()));
190+
mBody = std::move(body);
191191
}
192192

193193
std::string getResult() const

0 commit comments

Comments
 (0)