forked from boostorg/beast
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user