liberator

aspra 2017-04-14T13:15:52.216078Z

Hi all! I have a liberator newbie question: I am using liberator together with formidable and I have a sign up form which after validating the fields would lead to an account entry creation. However I would like to flash the validation errors on the same form if not correct so the user tries again. Any idea what is the right handler for this. I tried a few but without success plus conceptual dont seem right to me (like processable and malformed)

bostonaholic 2017-04-14T13:27:40.380687Z

I would say return a 401 Unauthorized. Which means the :authorized? decision

aspra 2017-04-14T13:54:48.801756Z

@bostonaholic thanks for your answer. I am wondering if thats the right way cause the error can be that the user didnt fill in the name for instance. Is this unauthorised? Or malformed?

bostonaholic 2017-04-14T13:59:12.875314Z

could be

bostonaholic 2017-04-14T14:00:51.906526Z

seems like personal preference to me

bostonaholic 2017-04-14T14:03:06.946920Z

https://tools.ietf.org/html/rfc7235#section-3.1

bostonaholic 2017-04-14T14:04:07.964931Z

I might agree that not sending a required field is 400

aspra 2017-04-14T14:46:51.725971Z

ok, thank you!

ordnungswidrig 2017-04-14T15:47:15.911317Z

Personally I'd prefer 422 because the form data in the request body is the entity that cannot be processed. But 400 is also wildly considered ok.

bostonaholic 2017-04-14T15:49:02.946481Z

422 is another good option

ordnungswidrig 2017-04-14T15:50:16.969705Z

By the words of the specification 400 is for request that are malformed on the network/encoding level but 422 is not in core http but only in webdav. Key advantage of using 422 is that you can interpret 400 as a software error (malformed JSON) and 422 as an application layer problem (invalid field value). The former is hardly fixable for the user, the latter is.