// Route: GET /governance/problem[/:status] (RFC 7807) #include "support/Assert.hpp" using namespace molo::example::test; using molo::example::fw::Method; int main() { Fixture f; check(f.client->get("/governance/problem").status == 200, "overview"); auto p = f.client->get("/governance/problem/404"); check(p.status == 404 && contains(p.headers.get("Content-Type"), "application/problem+json"), "problem content type"); check(contains(p.body, "\"status\":404") && contains(p.body, "\"title\"") && contains(p.body, "\"instance\""), "rfc7807 members"); auto bad = f.client->get("/governance/problem/200"); check(bad.status == 400 && contains(bad.headers.get("Content-Type"), "problem+json"), "out of range is 400"); check(f.client->get("/governance/problem/abc").status == 400, "non numeric"); check(f.client->post("/governance/problem/404").status == 405, "405"); return finish("governance/problem"); }