-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return body from PUT or POST #26
Comments
Yes, after consideration I think yada should support returning a body in PUT/POST as per the lines of the spec. Let's keep this issue open. |
Hi guys! (defrecord MyRecordType [d])
(extend-protocol PutResult
MyRecordType
(interpret-put-result [o ctx]
(assoc-in ctx [:response :body] (:d o))))
|
PUT bodies should work - see the phonebook example. Or do you mean On 8 March 2016 at 10:35, tangrammer notifications@github.com wrote:
|
sorry, I meant response bodies :) |
Thanks Malcolm! |
Yes... but my tests fail :( But give me a couple of hours...
|
👍 👍 |
Hi, You can do this by returning a modified response, which yada's method proxy (testing "return response" I've had to back out the last commit because it broke some test, but I've Regards, Malcolm JUXT LTD. On 8 March 2016 at 14:59, tangrammer notifications@github.com wrote:
|
Thanks for the solution :) I had to change the status to 200 in order to have aleph (or the yada handler?) actually serving the body. (with status 204, the body is not send, although the header contains a correct content length). To reflect that, I prepared a PR with the corresponding change in the test. Pull Request: #72 |
Currently it's impossible to return a body that contains e.g. a map of data from a PUT or POST method.
The reason is that there is no body conversion in PUT/POST as it is done in GetMethod/request.
Is this something yada intends to support? The HTTP spec allows for either referencing the newly created/updated entity or actually specifying it.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
Section 10.2.1 200 OK
POST an entity describing or containing the result of the action;
There's no mention about PUT 200 or 201 other than The newly created resource can be referenced by the URI(s) returned in the entity of the response, with the most specific URI for the resource given by a Location header field. The response SHOULD include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose the one most appropriate.
As this impacts all methods that can return a body, I'm not sure how you'd like to pull that out of the GetMethod.
The text was updated successfully, but these errors were encountered: