On Thu, 2013-06-06 at 10:44 -0500, Kris Borchers wrote:
So the issue here is the backend service. If the DELETE request is sent and an application/json response is expected, the backend must send valid JSON. An empty response is not valid JSON so jQuery gets it right by throwing an error. This was a recent addition/bug fix in jQuery to throw this error since that is the correct way to handle invalid JSON. The backend service needs to send something like [].


Thanks. I thought that the message body could be empty for the responses of DELETE requests. However as of jQ 1.9 empty responses are rejected.

On Jun 6, 2013, at 10:32 AM, Apostolos Emmanouilidis <aemmanou@redhat.com> wrote:

> Hi guys,
> 
> While writing some tests for the AeroGear JS API, I came across the following issue:
> 
> The Pipe.remove method of the AeroGear Android API does not require any data as a response. The callback has Void data. This means that the corresponding operation on the server/backend side returns an empty response.
> 
> However the AeroGear JS API relies on jQuery AJAX mechanism. When using the Pipe.remove method, jQuery tries to parse the empty response as JSON and it fails. I had to hack jQuery and add the following piece of code in order to use the same backend service for both AeroGear APIs:
> 
> parseJSON: function( data ) {
>         
>         if (!data) {
>             return null;
>         }
> 
> If you know any way to make the AeroGear JS Pipe.remove method to work when the server side returns an empty response and without hacking the JQuery, please share it.
> 
> Thanks,
> Tolis
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev


_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev