How to disable GZipContent in Cloud Endpoints builder in Android

前端 未结 3 775
迷失自我
迷失自我 2021-02-09 06:30

I want to disable GZipContent for a Google Cloud Endpoints class so that a POST can work on the local development server.

The latest GPE release generates this endpoint

3条回答
  •  你的背包
    2021-02-09 06:58

    For those that are Googling for the error I saw, it was java.io.EOFException, but only in the development server. Here's how I was able to fix this, using the example stated in the OP's question:

    Myendpoint myendpointClient = new Myendpoint.Builder(
                    AndroidHttp.newCompatibleTransport(),
                    new GsonFactory(),
                    credential).build();
    EndpointService svcCall = myendpointClient.endpointService("firstArg");
    // Note, I didn't call "execute()", as normal!
    svcCall.setDisableGZipContent(true);
    // This is also a handy place to set http headers, etc
    svcCall.getRequestHeaders().set("x-oddballhdr","OddballValue");
    // It's now time to call execute()
    svcCall.execute();
    

    That may be a bit simpler than the other helpful answers.

提交回复
热议问题