Closed itoldya closed 11 years ago
my english is excellent!
Hey @itoldya, we're having a discussion here regarding whether it's a good thing to just set the payload to None if there isn't the payload - namely, it makes sense to require that the request be a valid JSON object if you go to the trouble of specifying the content type as JSON. So I'm thinking about reverting this change and returning 400 again for this case.
What do you think about this? Do you have a use-case where it's neccessry to specify the JSON content-type but have an empty body?
Hello! in my project I use spinejs framework. I dont know is it right or wrong but spinejs framework to get root data send GET request with content_type = 'application/json' and no payload. How should look like request to get root data? (by root data I mean somethink like all items by category, "/api/item/category/")
Ok, after a bit of digging I've found an answer here. Restless should not attempt to parse body on GET request. On all other requests, when the body is parsed, if content type is json, the body should be a valid json object.
I'll keep this bug open until someone (nudge nudge @horva :) provides a fix.
Fixed in 0.0.6. Request body is not parsed for GET requests.
when i send request with content_type == 'application/json' and without payload i get error 400 {"error": "invalid JSON payload: No JSON object could be decoded"}