Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-53

DELETE HTTP response code and body are not compliant



    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • V2 1.0.0, V2 1.1.0
    • V2 1.1.0
    • odata2-jpa
    • None
    • olingo 1.1.0, tomcat 7


      The online documentation for OData V2 states the folowing with regards to DELETE requests (note the HTTP response code):
      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 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):
      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:

      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

      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

      and the body is ""

      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).




            chandan.v.a Chandan V.A
            shturec Georgi
            0 Vote for this issue
            4 Start watching this issue