@@ -596,6 +596,7 @@ struct Response {
596
596
void set_redirect (const std::string &url, int status = StatusCode::Found_302);
597
597
void set_content (const char *s, size_t n, const std::string &content_type);
598
598
void set_content (const std::string &s, const std::string &content_type);
599
+ void set_content (std::string &&s, const std::string &content_type);
599
600
600
601
void set_content_provider (
601
602
size_t length, const std::string &content_type, ContentProvider provider,
@@ -5350,6 +5351,15 @@ inline void Response::set_content(const std::string &s,
5350
5351
set_content (s.data (), s.size (), content_type);
5351
5352
}
5352
5353
5354
+ inline void Response::set_content (std::string &&s,
5355
+ const std::string &content_type) {
5356
+ body = std::move (s);
5357
+
5358
+ auto rng = headers.equal_range (" Content-Type" );
5359
+ headers.erase (rng.first , rng.second );
5360
+ set_header (" Content-Type" , content_type);
5361
+ }
5362
+
5353
5363
inline void Response::set_content_provider (
5354
5364
size_t in_length, const std::string &content_type, ContentProvider provider,
5355
5365
ContentProviderResourceReleaser resource_releaser) {
0 commit comments