Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Commit c7a278f

Browse files
committed
Content-Length always on POST methods
1 parent b7da050 commit c7a278f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/aegis/rest/impl/rest_controller.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ AEGIS_DECL rest_reply rest_controller::execute(rest::request_params && params)
115115
request_stream << "Content-Length: " << ss.str().length() << "\r\n\r\n";
116116
request_stream << ss.str();
117117
}
118-
else if (!params.body.empty())
118+
else if (!params.body.empty() || params.method == Post || params.method == Put || params.method == Patch)
119119
{
120120
request_stream << "Content-Length: " << params.body.size() << "\r\n";
121121
request_stream << "Connection: close\r\n";
@@ -232,7 +232,7 @@ AEGIS_DECL rest_reply rest_controller::execute2(rest::request_params && params)
232232
for (auto & h : params.headers)
233233
request_stream << h << "\r\n";
234234

235-
if (!params.body.empty())
235+
if (!params.body.empty() || params.method == Post || params.method == Put || params.method == Patch)
236236
{
237237
request_stream << "Connection: close\r\n";
238238
request_stream << "Content-Length: " << params.body.size() << "\r\n";
@@ -275,7 +275,7 @@ AEGIS_DECL rest_reply rest_controller::execute2(rest::request_params && params)
275275
for (auto & h : params.headers)
276276
request_stream << h << "\r\n";
277277

278-
if (!params.body.empty())
278+
if (!params.body.empty() || params.method == Post || params.method == Put || params.method == Patch)
279279
{
280280
request_stream << "Connection: close\r\n";
281281
request_stream << "Content-Length: " << params.body.size() << "\r\n";

0 commit comments

Comments
 (0)