Bruce Hunter - 471 - Mar 11, 2014

I have a question about the ResponseStatus.Message property.

When I throw a Fluent Validation Error. The Message property gets populated with all the messages in the Error list object. So if I have a long Error message in the array, it gets duplicated in the Message as well. This Error message returns a list of IDs not validate for example. I don’t want to have double the data coming back on the wire.

To me the message property isn’t particularly important. If a client wants to know the errors and the messages, they would just check the Error array instead.

Suggestions , comments?

Mike Mertsock:

You can customize the response for validation failures by implementing a callback exposed by the ValidationFeature plugin:

    // in your AppHost setup code
    Plugins.Add(new ValidationFeature { ErrorResponseFilter = ValidationErrorFilter });

    private object ValidationErrorFilter(ValidationResult validationResult, object o)
        var httpError = o as HttpError;
        // you can customize the Message or other
        // properties of HttpError here
        return httpError;

Bruce Hunter:

Thanks, I’ll give it a try.