req is passed to render:

void defaultHandler(HttpServerRequest req, HttpServerResponse res)
{

render!("test.dt", req)(res);

}

template:

extends layout

block content

h3 this is a form:
form(method='get')
    fieldset
        legend General
            label(for='username') Username:
                - auto v = req.params["username"];
                input( type='text', name='username', value='#{v}' )

result is:

<!DOCTYPE html>
<html lang="ru">

<head>
	<title>Info</title>
</head>
<body>
	<h1>test</h1>
	<img id="logo" src="/images/blyat.jpg" alt="Site logo"/>
	<h3>this is a form:</h3>
	<form method="get">
		<fieldset>
			<legend>General
				<label for="username">Username: