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