Fork me on GitHub
#liberator
<
2017-04-14
>
aspra13:04:52

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)

bostonaholic13:04:40

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

aspra13:04:48

@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?

bostonaholic14:04:51

seems like personal preference to me

bostonaholic14:04:07

I might agree that not sending a required field is 400

aspra14:04:51

ok, thank you!

ordnungswidrig15:04:15

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.

bostonaholic15:04:02

422 is another good option

ordnungswidrig15:04:16

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.