Thank you, Geert, I did not know we had a gunzip function, good to know!

  So it seems the HTTP client does not honour the Content-Encoding.
Should I open a ticket, or did I miss something?

  Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/


On 19 June 2015 at 20:02, Geert Josten wrote:
> Try this instead:
>
> var url = "http://api.stackexchange.com/2.2/";;
> xdmp.gunzip(fn.subsequence(xdmp.httpGet(url, { format: 'binary' }), 2, 1),
> { format: 'json'});
>
>
> Cheers
>
> On 6/19/15, 7:20 PM, "Florent Georges" <[email protected]> wrote:
>
>>  Hi,
>>
>>  The following query:
>>
>>    var url = "http://api.stackexchange.com/2.2/";;
>>    xdmp.httpGet(url);
>>
>>throws the error:
>>
>>    XDMP-JSONDOC: [...] -- Document is not JSON
>>
>>  Is it possible this is related to the API always returning
>>GZIP-encoded content?  It can return DEFLATE-encoded content as well,
>>but the problem remains the same when passing Accept-Encoding:
>>DEFLATE.
>>
>>  If trying to get the result with format: "text", the error is
>>"document is not UTF-8 encoded", which is true if the GZIP encoding is
>>not taken into account.
>>
>>  Regards,
>>
>>--
>>Florent Georges
>>http://fgeorges.org/
>>http://h2oconsulting.be/
>>_______________________________________________
>>General mailing list
>>[email protected]
>>Manage your subscription at:
>>http://developer.marklogic.com/mailman/listinfo/general
>
> _______________________________________________
> General mailing list
> [email protected]
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to