2

I have HTTP DELETE API endpoint with some body in response.

If I try to send that request over wi-fi network, I get complete response: HTTP headers and response body. After switching off the wi-fi and sending the request over cellular network, I get response consisting only of HTTP headers and with no body.

This behavior is the same on HTTPUrlConnection and OkHttp transport layer. Retrofit 1.6.1, Android 5.1.1 on Nexus 5.

Here is retrofit interface:

public interface VoteInterface {
    @DELETE("/product/{product_id}/{vote_type}")
    VoteResponse unvote(
            @Query("access_token") String token,
            @Path("product_id") String productId,
            @Path("vote_type") String voteType
    );
}

Initialization:

// ... snip ...
RestAdapter.Builder builder = super.createRestAdapterBuilder();
builder.setLogLevel(RestAdapter.LogLevel.FULL);
return builder;

The rest of work is done by Robospice code, I guess it is not so interesting to inspect the issue.

Here is the part of Retrofit logs:

09-10 01:00:33.233  27443-27509/... D/Retrofit﹕ ---> HTTP DELETE http://.../product/55ba5fe611ce3907288b4567/unlike?access_token=DaoHrTqvuAot1qDsRbbVvDxeuQVBnSMO0iLrKlEm
09-10 01:00:33.233  27443-27509/... D/Retrofit﹕ ---> END HTTP (no body)
09-10 01:00:33.393  27443-27509/c... D/Retrofit﹕ <--- HTTP 200 http://.../product/55ba5fe611ce3907288b4567/unlike?access_token=DaoHrTqvuAot1qDsRbbVvDxeuQVBnSMO0iLrKlEm (160ms)
09-10 01:00:33.393  27443-27509/... D/Retrofit﹕ : HTTP/1.1 200 OK
09-10 01:00:33.393  27443-27509/... D/Retrofit﹕ Connection: keep-alive
09-10 01:00:33.393  27443-27509/... D/Retrofit﹕ Content-Type: application/json
09-10 01:00:33.393  27443-27509/... D/Retrofit﹕ Date: Wed, 09 Sep 2015 22:00:41 GMT
09-10 01:00:33.393  27443-27509/... D/Retrofit﹕ OkHttp-Received-Millis: 1441836033393
09-10 01:00:33.393  27443-27509/... D/Retrofit﹕ OkHttp-Response-Source: NETWORK 200
09-10 01:00:33.393  27443-27509/... D/Retrofit﹕ OkHttp-Selected-Protocol: http/1.1
09-10 01:00:33.393  27443-27509/... D/Retrofit﹕ OkHttp-Sent-Millis: 1441836033243
09-10 01:00:33.393  27443-27509/... D/Retrofit﹕ Server: nginx
09-10 01:00:33.393  27443-27509/... D/Retrofit﹕ Transfer-Encoding: chunked
09-10 01:00:33.394  27443-27509/... D/Retrofit﹕ Vary: Accept-Encoding
09-10 01:00:33.394  27443-27509/... D/Retrofit﹕ X-Powered-By: PHP/5.5.26-1~dotdeb+7.4
09-10 01:00:33.394  27443-27509/... D/Retrofit﹕ ---- ERROR http://.../product/55ba5fe611ce3907288b4567/unlike?access_token=DaoHrTqvuAot1qDsRbbVvDxeuQVBnSMO0iLrKlEm
09-10 01:00:33.398  27443-27509/... D/Retrofit﹕ java.io.EOFException
            at okio.RealBufferedSource.require(RealBufferedSource.java:64)
            at okio.GzipSource.consumeHeader(GzipSource.java:114)
            at okio.GzipSource.read(GzipSource.java:73)
            at okio.RealBufferedSource$1.read(RealBufferedSource.java:371)
            at java.io.InputStream.read(InputStream.java:162)
            at retrofit.Utils.streamToBytes(Utils.java:43)
            at retrofit.Utils.readBodyToBytesIfNecessary(Utils.java:81)
            at retrofit.RestAdapter.logAndReplaceResponse(RestAdapter.java:470)
            at retrofit.RestAdapter.access$500(RestAdapter.java:109)
            at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:333)
            at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
            at java.lang.reflect.Proxy.invoke(Proxy.java:397)
            at $Proxy12.unvote(Unknown Source)
            at ....VoteRequest.loadDataFromNetwork(VoteRequest.java:35)
            at ....VoteRequest.loadDataFromNetwork(VoteRequest.java:5)
            at com.octo.android.robospice.request.CachedSpiceRequest.loadDataFromNetwork(CachedSpiceRequest.java:48)
            at com.octo.android.robospice.request.DefaultRequestRunner.processRequest(DefaultRequestRunner.java:150)
            at com.octo.android.robospice.request.DefaultRequestRunner$1.run(DefaultRequestRunner.java:217)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
09-10 01:00:33.398  27443-27509/... D/Retrofit﹕ ---- END ERROR

`

Victory
  • 5,811
  • 2
  • 26
  • 45
  • Can you post code that reproduces your problem? – fractalwrench Sep 09 '15 at 21:51
  • it is http or https? (i would not be surprised if some network provider considered that responses from a DELETE did not need to be transmitted) – njzk2 Sep 09 '15 at 22:24
  • I use http. What you mean about 'network provider' - isp or underlying service? The behavior is the different on the same uri with different transports. – Anton Isolenta Sep 10 '15 at 04:29

0 Answers0