| 14 | namespace HTTP { |
| 15 | |
| 16 | void HTTPSServer::AddStaticContent(const CppCommon::Path& path, const std::string& prefix, const CppCommon::Timespan& timeout) |
| 17 | { |
| 18 | auto hanlder = [](CppCommon::FileCache & cache, const std::string& key, const std::string& value, const CppCommon::Timespan& timespan) |
| 19 | { |
| 20 | auto response = HTTPResponse(); |
| 21 | response.SetBegin(200); |
| 22 | response.SetContentType(CppCommon::Path(key).extension().string()); |
| 23 | response.SetHeader("Cache-Control", CppCommon::format("max-age={}", timespan.seconds())); |
| 24 | response.SetBody(value); |
| 25 | return cache.insert(key, response.cache(), timespan); |
| 26 | }; |
| 27 | |
| 28 | cache().insert_path(path, prefix, timeout, hanlder); |
| 29 | } |
| 30 | |
| 31 | } // namespace HTTP |
| 32 | } // namespace CppServer |
nothing calls this directly
no test coverage detected