15 lines
630 B
C++
15 lines
630 B
C++
// Route: GET /security/headers (hardening headers applied)
|
|||
|
|
#include "support/Assert.hpp"
|
||
|
|
using namespace molo::example::test;
|
||
|
|
int main() {
|
||
|
|
Fixture f;
|
||
|
|
auto r = f.client->get("/security/headers");
|
||
|
|
check(r.status == 200, "status 200");
|
||
|
|
check(r.headers.get("X-Content-Type-Options") == "nosniff", "nosniff");
|
||
|
|
check(r.headers.get("X-Frame-Options") == "DENY", "frame deny");
|
||
|
|
check(r.headers.has("Strict-Transport-Security"), "hsts");
|
||
|
|
check(contains(r.body, "Referrer-Policy"), "body lists headers");
|
||
|
|
check(f.client->post("/security/headers", "x").status == 405, "POST is 405");
|
||
|
|
return finish("security/headers");
|
||
|
|
}
|