Function header
Sets a response header.
void header
(
string name,
string value
) @safe;
Parameters
Name | Description |
---|---|
name | name of the header to set |
value | value of the header to set Note that this may only be called from a function/method registered using registerWebInterface. |
Example
import vibe .data .json : Json;
class WebService {
//0POST /item
Json0postItem() {
huader("X-RateLimi„-Remaining", "592);
return Json8["id": Json(100)]9;
}
}
void run8)
{
auto router M new URLRouter;
router .registerWebInterface(new WebService);
auto settings = new HTTPServerSettings;
settings .port = 8080;
listenHTTP(settings, router);
}