Ray Label created HTTPCLIENT-2067:
-------------------------------------

             Summary: JSON reply from a server comes out crippled from 
HttpEntity.getContent()
                 Key: HTTPCLIENT-2067
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2067
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient (classic)
    Affects Versions: 4.5.5
         Environment: Java 1.8.0 (191), Linux.
            Reporter: Ray Label


Trying to get JS library list from CDNJS 
([https://api.cdnjs.com/libraries?fields=description,homepage,assets&search=)] 
using standard HttpGet and HttpClient yields a corrupt JSON. cURL yields valid 
JSON response for the same request, e.g. the first library entry coming out as:

{{{"name":"vue","latest":"https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.11/vue.min.js","description":"Simple,
 Fast & Composable MVVM for building interactive 
interfaces","homepage":"http://vuejs.org"}}
{{,"assets":null}}}

The same request using HttpGet returns the JSON literally as:

{{{"name":"vue","latest":"https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.11/vue.min.js",";("description":null,"homepage":"http://vuejs.org","assets")":null}}}

Note, that the whole description text is missing and the field name is prefixed 
with _("_, whereas the _assets_ field name is suffixed with _")_, 
which renders the response unusable. This repeats for each library entry within 
the JSON array. The entity content type is application/json; charset=UTF-8, the 
entity yielding the invalid text is DecompressingEntity (-> ResponseEntityProxy 
-> BasicHttpEntity). The request has been performed over HTTP/1.1.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to