18 lines
597 B
C++
18 lines
597 B
C++
// Route: GET /static/{name} (disk static, traversal guard)
|
|||
|
|
#include "support/Assert.hpp"
|
||
|
|
|
||
|
|
using namespace molo::example::test;
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
Fixture f;
|
||
|
|
auto css = f.client->get("/static/app.css");
|
||
|
|
check(css.status == 200, "css status 200");
|
||
|
|
check(contains(css.headers.get("Content-Type"), "text/css"),
|
||
|
|
"css content type");
|
||
|
|
check(css.headers.has("ETag"), "etag present");
|
||
|
|
check(contains(css.body, "nav-narrow"), "stylesheet served");
|
||
|
|
auto missing = f.client->get("/static/nope.css");
|
||
|
|
check(missing.status == 404, "missing file is 404");
|
||
|
|
return finish("static/files");
|
||
|
|
}
|