Currently you can create entities without bundles, which will break the overview of that entity type.
We should restrict that somehow.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | fix_no_bundles2.patch | 2.93 KB | sepgil |
| #1 | fix_no_bundles.patch | 2.8 KB | sepgil |
Currently you can create entities without bundles, which will break the overview of that entity type.
We should restrict that somehow.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | fix_no_bundles2.patch | 2.93 KB | sepgil |
| #1 | fix_no_bundles.patch | 2.8 KB | sepgil |
Comments
Comment #1
sepgil commentedI made a patch, which fixes this issue and also added a test to test the new functionality. However I'm not sure if I'm returning the right HTTP status code(currently 406 Not Acceptable). Would it be better to use 400 Bad Request.
Btw: I also fixed 2 spelling errors I found in some comments.
Comment #2
klausiinline if statements are not allowed, always use "{}"
That comment does not really fit, shouldn't it be "Test bad creation request with missing bundle key"?
I think you should also check that loading the node by the title does not return any result (after the request).
I'm not sure about 400 vs. 406. 400 says that the syntax is malformed, which is not the case here. On the other hand 406 says that the request does not conform to the accept headers, so this seems wrong, too.
Comment #3
sepgil commentedI wanted a general comment & title, in case we want to add more tests to this function. I renamed it to testBadRequests.
I've fixed the other 2 issues to in the new patch.
There seems to be no appropriate status code for it, so maybe should keep 406 for now...
Comment #4
klausiCommitted, thanks! http://drupalcode.org/project/restws.git/commit/2318d17