function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vidya BhandaryVidya Bhandary 

setCompressed problem when calling REST API - To reduce size of response

I am trying to see if I can reduce the size of the response from my REST API service.

1. Currently I am using a VF page to call the REST service but when I try to use setCompressed(true) - I get the following message

message":"Unexpected EOF encountered while initializing GZIP stream","errorCode":"UNKNOWN_EXCEPTION

2. I tried to use the deflate option but the response comes as junk chars. I thought the getBody() method was supposed to decode this ?
[ Accept-Encoding as deflate  ]

3. Regardless of whether I use gzip or not - the response size is the same. So that clearly this compression is not working.
[ Accept-Encoding as gzip  ]

4. I tried to use POST as mentioned in one forum discussion but that gave me an error saying only "GET" and "HEADER" requests were supported.

Any ideas on why compression is not working ? Does salesforce support this feature or not ?

Vidya BhandaryVidya Bhandary
In 'deflate' option. It only returns junk values although the HTTP response is 200. Is there a way to get the original chars back ? Since I am using VisualForce call to APEX Rest - does it means there is a specific setting in Visual force that I need to set for this ?