add file support
This commit is contained in:
parent
7ab65a520f
commit
37a7202376
|
@ -25,9 +25,11 @@ FileResponse GetStaticAssetHandler(const StringRequest& req)
|
|||
if (sys::error_code ec; file.open(abs_path.string().c_str(), beast::file_mode::read, ec), ec)
|
||||
{
|
||||
res.result(http::status::not_found);
|
||||
res.set(http::field::content_type, content_type::k_TextPlain);
|
||||
}
|
||||
else
|
||||
{
|
||||
res.result(http::status::ok);
|
||||
res.body() = std::move(file);
|
||||
res.prepare_payload();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue