Skip to content

Controller

isHead()

isHead() — returns boolean

Available in: controller Category: Miscellaneous Functions

Checks if the current HTTP request method is HEAD. HEAD requests are similar to GET requests but do not return a message body, only the headers. This is often used for checking metadata like content length or existence without transferring the actual content.

component extends="Controller" {

    public void function checkFile() {
        if (isHead()) {
            // Respond with headers only, no content
        } else {
            // Handle normal GET or other requests
            fileData = model("File").findByKey(params.id);
            renderWith(action="show", data=fileData);
        }
    }

}