Controller
isHead()
Signature
Section titled “Signature”isHead() — returns boolean
Available in: controller
Category: Miscellaneous Functions
Description
Section titled “Description”Returns whether the request was a HEAD request or not.
Examples
Section titled “Examples”// 1. Respond to a HEAD request by rendering nothing
if (isHead()) {
renderNothing();
}
// 2. Restrict an action to HEAD requests only
if (!isHead()) {
renderText("Method not allowed");
}
// 3. Store the result to use in a conditional
requestIsHead = isHead();
// requestIsHead -> true when the HTTP method is HEAD, false otherwise