feat(workflow): example covers security, platform, enterprise and resilience features
105 route tests, matrix crawl, spec and README updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// Route: GET/POST /middleware/demo (builtin chain: headers, body limit, timing)
|
||||
#include "support/Assert.hpp"
|
||||
|
||||
using namespace molo::example::test;
|
||||
using molo::example::fw::Method;
|
||||
|
||||
int main() {
|
||||
Fixture f;
|
||||
auto res = f.client->get("/middleware/demo");
|
||||
check(res.status == 200, "status 200");
|
||||
check(res.headers.get("X-Content-Type-Options") == "nosniff", "secure headers");
|
||||
check(res.headers.get("X-Frame-Options") == "DENY", "frame options");
|
||||
check(res.headers.has("X-Response-Time-Us"), "timing header");
|
||||
auto small = f.client->request(Method::Post, "/middleware/demo", "tiny");
|
||||
check(small.status == 200 && contains(small.body, "Received 4 body bytes"), "small body passes");
|
||||
auto big = f.client->request(Method::Post, "/middleware/demo", std::string(65, 'x'));
|
||||
check(big.status == 413, "body limit 413");
|
||||
check(big.headers.get("X-Frame-Options") == "DENY", "outer middleware still runs on short circuit");
|
||||
check(f.client->request(Method::Delete, "/middleware/demo").status == 405, "delete is 405");
|
||||
return finish("middleware/demo");
|
||||
}
|
||||
Reference in New Issue
Block a user