Calls an application's routes in-process, without listen() or sockets: for fast, port-free tests.
More...
Calls an application's routes in-process, without listen() or sockets: for fast, port-free tests.
Requests go through the same router as on the network: global, prefix and group middleware, routing (404/405), error handlers, sessions. Responses are collected in memory, chunks and SSE events included. Coroutine handlers work: the client runs a small thread pool and event loop of its own (ResponseWriter::thread_pool() / proactor()) and waits for the response.
app.
post(
"/tasks", create_task);
auto res = client.post("/tasks").json({{"title", "x"}}).send();
EXPECT_EQ(res.status, 201);
The main application class for the Orbit Framework.
Definition App.hpp:36
App & post(const std::string &path, routing::RouteHandler handler)
Registers a POST route.
Calls an application's routes in-process, without listen() or sockets: for fast, port-free tests.
Definition Client.hpp:105
The client keeps a cookie jar: cookies the application sets are sent with later requests, so a login followed by an authenticated request works. What the network layer adds (Date, Content-Length framing, compression of the wire format) is not applied.