You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am going through liberator put-all-together example and I am puzzled as of why json parsing occurs so early in the decision tree (:malformed? node). The content header is checked in the later stage (:known-content-type?). So, if content is not json, I am parsing it for nothing.
It looks to me that either malfromed? should occur later in the decision tree, or the tutorial's json parsing should occur in processable? node.
The text was updated successfully, but these errors were encountered:
You've found an issue. As stated in the documentation :malformed? is for HTTP protocol level errors when parsing the request. One can argue whether invalid data in the request entity ("body") counts as an malformed request or not. In general I would advise to use :processable? for this but unfortunately the status code 422 "not-processable" is not part of the HTTP spec but defined in a WebDAV extension.
IIRC the tutorial was written at a time when :processable? did not yet exist in liberator. In any case the :malformed? function must take the request content-type into account before trying to parse it as JSON.
I am going through liberator put-all-together example and I am puzzled as of why json parsing occurs so early in the decision tree (
:malformed?
node). The content header is checked in the later stage (:known-content-type?
). So, if content is not json, I am parsing it for nothing.It looks to me that either
malfromed?
should occur later in the decision tree, or the tutorial's json parsing should occur inprocessable?
node.The text was updated successfully, but these errors were encountered: