Deprecate string_param (API Change):

API Changes:

`string_param`, which was previously the argument type when setting field values
has been replaced by `string_view`. Because of this, it is no longer possible to
set message field values directly as integrals.

Users are required to convert numeric arguments to a string type prior to calling
`fields::set` et. al.

Beast provides the non-allocating `to_static_string()` function for this purpose.

To set Content-Length field manually, call `message::content_length`.

fixes #1956
This commit is contained in:
Richard Hodges
2020-06-12 17:33:20 +02:00
parent ae2b699e04
commit 14c3d50b57
14 changed files with 75 additions and 137 deletions
+3 -2
View File
@@ -18,6 +18,7 @@
#include <boost/beast/core/buffers_to_string.hpp>
#include <boost/beast/core/error.hpp>
#include <boost/beast/core/multi_buffer.hpp>
#include <boost/beast/core/static_string.hpp>
#include <boost/beast/_experimental/test/stream.hpp>
#include <boost/beast/test/yield_to.hpp>
#include <boost/beast/_experimental/unit_test/suite.hpp>
@@ -642,7 +643,7 @@ public:
m.method(verb::get);
m.version(11);
m.target("/");
m.set("Content-Length", 5);
m.set("Content-Length", to_static_string(5));
m.body() = "*****";
async_write(ts, m, handler{});
BEAST_EXPECT(handler::count() > 0);
@@ -665,7 +666,7 @@ public:
m.method(verb::get);
m.version(11);
m.target("/");
m.set("Content-Length", 5);
m.set("Content-Length", to_static_string(5));
m.body() = "*****";
async_write(ts, m, handler{});
BEAST_EXPECT(handler::count() > 0);