On Tue, Aug 19, 2008 at 1:17 PM, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > > i'm not sure if i like the idea of this. > > the 400 error is for bad/malformed syntax and the request can't be > fulfilled. > > in this situation, the http level request is most certainly understood > and authorized -- the error is in the application logic and should be > served on such -- not pushed into the http level. > > a non-browser, or browser, app can just expect a json packet as such: > > status: error / success > success: more info > error: detailed info or hash of info > additional_fields > > and have all the information needed to intereact with pylons. i don't > see how saying that a 'good request' is a bad request will make things > easier. > > >
Returning 400 for form validation error is recommended by Leonard Richardson and Sam Ruby in the book RESTful Web Services. Here's an excerpt from one of the examples in the book: "If the client sends bad or incomplete data, the ActiveRecord validation rules (defined in the User) model) fail, and the call to User#save returns false. The response code then is 400 ("Bad Request")." Also, according to the specifications for OpenID and OAuth, both of them return 400 for bad or missing parameters. I don't see any difference between an OAuth service provider implemented using pylons and my custom pylons web app. If the former shall return 400 for bad or missing parameters, why can't the later? By the way, structs has a bug report for the same issue that was resolved as "Not A Problem", forcing their users to resort to subclassing. So I guess it's OK if you don't like the idea :) Regards, Yap --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---