Full C++23 framework tree: runtime, observability, security, data, app, realtime, supervisor, clients, CLI, example plus enterprise tenancy, audit, operability, governance, supplychain. Postgres via docker compose for tests.
22 lines
894 B
C++
22 lines
894 B
C++
// Route: /routing/views/greet (class-based view, GET plus POST)
|
|
#include "support/Assert.hpp"
|
|
|
|
using namespace molo::example::test;
|
|
|
|
int main() {
|
|
Fixture f;
|
|
auto get = f.client->get("/routing/views/greet?name=grace");
|
|
check(get.status == 200, "GET status 200");
|
|
check(contains(get.body, "GreetView"), "view dispatched GET");
|
|
check(contains(get.body, "grace"), "query value used");
|
|
auto post = f.client->post("/routing/views/greet", "name=ada",
|
|
"application/x-www-form-urlencoded");
|
|
check(post.status == 200, "POST status 200");
|
|
check(contains(post.body, "\"method\":\"POST\""), "view dispatched POST");
|
|
auto put = f.client->request(molo::example::fw::Method::Put,
|
|
"/routing/views/greet");
|
|
check(put.status == 404 || put.status == 405,
|
|
"unregistered method rejected");
|
|
return finish("routing/views");
|
|
}
|