response

Returns the current response.

Note that this may only be called from a function/method registered using registerWebInterface.

@property @safe
HTTPServerResponse
response
()

Examples

void logIn()
{
	auto session = response.startSession();
	session.set("token", "secret");
}

class WebService {
	void postLogin(string username, string password)
	{
		if (username == "foo" && password == "bar") {
			logIn();
		}
	}
}

void run()
{
	auto router = new URLRouter;
	router.registerWebInterface(new WebService);

	auto settings = new HTTPServerSettings;
	settings.port = 8080;
	listenHTTP(settings, router);
}

Meta