Georgi created OLINGO-53:
----------------------------
Summary: DELETE HTTP response code and body are not compliant
Key: OLINGO-53
URL: https://issues.apache.org/jira/browse/OLINGO-53
Project: Olingo
Issue Type: Bug
Components: odata2-core
Affects Versions: 1.0.0, 1.1.0
Environment: olingo 1.1.0, tomcat 7
Reporter: Georgi
Priority: Blocker
The online documentation for OData V2 states the folowing with regards to
DELETE requests (note the HTTP response code):
http://www.odata.org/documentation/odata-v2-documentation/operations/#28_Deleting_Entries
Entries are deleted by executing an HTTP DELETE request against a URI that
points at the Entry. If the operation executed successfully, servers should
return 200 (OK) with no response body.
The PDF variant of the V3 documentation states the following(note the HTTP
response code):
http://download.microsoft.com/download/9/5/E/95EF66AF-9026-4BB0-A41D-A4F81802D92C/[MS-ODATA].pdf
2.2.7.4.1 DeleteEntity Request
A DeleteEntity request MUST have an empty (0 bytes) payload. If the
DeleteEntity request was successful, the response MUST have a 204 (No Content)
status code, as specified in [RFC2616].
I can't reach the PDF version for V2, but I was told by the JayData team that
it states the same (see https://github.com/jaydata/jaydata/issues/110).
The generic HTTP specification states the following with regards to the DELETE
method (note the HTTP response code):
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7
A successful response SHOULD be 200 (OK) if the response includes an entity
describing the status, 202 (Accepted) if the action has not yet been enacted,
or 204 (No Content) if the action has been enacted but the response does not
include an entity.
As OData is a restful protocl it makes absolutely no sense to deviate from the
standard HTTP without a good reason. As no such reason has been given, and
since the PDF version states more reasonably that the return code for a
successfull DELETE should be 204 as in RFC 2616, my conclusion is that the
online documentaiton simply has a typo/error.
Unfortunately olingo, similiar to odata4j, returns 200 on successfull DELETE.
This is a big problem because many clients that have considered the more
reasonable variant with return code 204, would interpret the 200 code as
something tha carries content and will try to parse the payload. Since the
payload is an empty string ("") it has no chance e.g. with a json parser.
For reference, the HTTP comunitation log for a DELETE request to olingo
currently goes as following:
Request:
DELETE <path-to-service>/SomeEntity(<someid>) HTTP/1.1
MaxDataServiceVersion: 2.0
Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5,
*/*;q=0.1
DataServiceVersion: 2.0
Response:
HTTP/1.1 200 OK
DataServiceVersion: 2.0
Date: Thu, 31 Oct 2013 09:24:41 GMT
Content-Type: application/json; odata=verbose
Content-Length: 0
Clearly, this complies with the online documentation, but that makes no sense
at all. And the implication is that this makes olingo non-compliant with client
libraries (datajs adn jaydata for example).
--
This message was sent by Atlassian JIRA
(v6.1#6144)