Skip to content

Commit a623730

Browse files
committed
Fixes #35
Making calls to client.post and client.put smarter with the provided request objects.
1 parent 18271fe commit a623730

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

boost/network/protocol/http/client/facade.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ namespace boost { namespace network { namespace http {
5656

5757
response const post (request request_, string_type const & content_type, string_type const & body_) {
5858
request_ << ::boost::network::body(body_)
59-
<< header("Content-Type", content_type)
6059
<< header("Content-Length", boost::lexical_cast<string_type>(body_.size()));
60+
if (!boost::empty(headers(request_)["Content-Type"]))
61+
request_ << header("Content-Type", content_type);
6162
return post(request_);
6263
}
6364

@@ -75,8 +76,9 @@ namespace boost { namespace network { namespace http {
7576

7677
response const put (request request_, string_type const & content_type, string_type const & body_) {
7778
request_ << ::boost::network::body(body_)
78-
<< header("Content-Type", content_type)
7979
<< header("Content-Length", boost::lexical_cast<string_type>(body_.size()));
80+
if (!boost::empty(headers(request_)["Content-Type"]))
81+
request_ << header("Content-Type", content_type);
8082
return put(request_);
8183
}
8284

0 commit comments

Comments
 (0)