Files
moloapp/tests/example/routing/hello_test.cpp
T

17 lines
568 B
C++
Raw Normal View History

// Route: GET /routing/hello/{name}
#include "support/Assert.hpp"
using namespace molo::example::test;
int main() {
Fixture f;
auto res = f.client->get("/routing/hello/ada");
check(res.status == 200, "status 200");
check(contains(res.body, "\"hello\":\"ada\""), "path param bound");
auto encoded = f.client->get("/routing/hello/a%20b");
check(contains(encoded.body, "\"hello\":\"a b\""), "param url-decoded");
auto missing = f.client->get("/routing/hello");
check(missing.status == 404, "missing segment is 404");
return finish("routing/hello");
}