Body

Attribute that indicates that the parameter is converted from the request's body. The parameter must be either a struct or a class that will be insantiated by the validator and validated by it. The method is not usually called when the validation fails, but if the method also contains a scorpion.validation.Validation object as paramter the method is called even when the object was not successfully validated. To learn more about the validation process and the attributes that can be added to the object's members to validate see the scorpion.validation module's documentation.

Examples

struct Message {

   string sender, message;

}

@Post("hello")
_(Response response, @Body Message message) {
   response.body_ = "Hello, " ~ message.sender ~ ", thanks for the message.";
}

Meta