json-parser plugin does not handle DELETE requests
Closed this issue · 2 comments
I'm using Roda to implement a JSONAPI API. I'm attempting to use the json-parser
plugin to parse incoming JSON bodies. Unfortunately, this only seems to work for POST and PATCH requests -- it doesn't work for DELETE (and it needs to for JSONAPI). The documentation does not mention that request bodies are parsed only for certain HTTP methods. And when I look at the source, I can't see any way to change this behavior. It seems like the conditions under which the parser is invoked should at least be documented and, even better, configurable.
Are you sure this is an issue with Roda itself? There does not appear to be anything in the json_parser plugin specific to the request method, and changing POST
-> DELETE
in the request methods results in the specs still passing (modulo one issue where rack will parse request bodies without a content-type only for POST
requests).
Can you please provide a minimal self-contained example showing the problem, preferably in the form of a spec?
Argh, turns out to be an issue with Rack::Test
: see here. What should be being passed as a body is instead passed as query params, which json_parser
doesn't parse. I thought this was a JSON API issue because only the POST
in RequestMethods is defined in the source. Anyway, sorry to post a fake issue and thank you for the prompt response.