Controller
isPut()
Signature
Section titled “Signature”isPut() — returns boolean
Available in: controller
Category: Miscellaneous Functions
Description
Section titled “Description”Returns whether the request was a PUT request or not.
Examples
Section titled “Examples”// 1. Allow only PUT requests for a resource update action
if (!isPut()) {
redirectTo(action = "index");
}
// ... proceed with update logic
// 2. Branch behavior based on HTTP method
if (isPut()) {
// Full replacement of the resource
user = model("User").findByKey(params.key);
user.update(params.user);
redirectTo(action = "show", key = user.key());
} else {
renderNothing();
}