Parse.Cloud.httpRequest response issue

187 views
Skip to first unread message

Johnny Zen

unread,
Aug 25, 2016, 5:43:00 AM8/25/16
to back{4}app
Hi all

I am using a Parse.Cloud.httpRequest which I use on parse.com with no problems.

On back4app, the response is full of � \��W ���]s�F���ϯ`�f��)'����e��� (its not SSL)

So I assuming its a character encoding issue. The http file is XML : <?xml version="1.0" encoding="utf-8"?>

I have tried adding header using:

```
headers: { 'Content-Type': 'application/xml;charset=utf-8' },
```

but doesnt make any difference :(

Can anyone assist please


Best regards



Johnny


Johnny Zen

unread,
Aug 25, 2016, 5:49:56 AM8/25/16
to back{4}app
this is a get request btw :)

Johnny Zen

unread,
Aug 25, 2016, 6:27:47 AM8/25/16
to back{4}app
I have now added:

headers: {
'Accept': 'application/xml',
'Accept-Encoding': 'gzip, deflate'
        },

but this doesnt make any difference either :(

Davi Macêdo

unread,
Aug 25, 2016, 4:46:24 PM8/25/16
to back{4}app
Hi Johnny,

In Parse Server, Parse.Cloud.httpRequest is little bit different of parse.com one. Basically it is an alias for request module (https://github.com/request/request).

Could you please paste here your complete request, including url?

Best.

Johnny Zen

unread,
Aug 26, 2016, 3:26:07 AM8/26/16
to back{4}app
Hi Davi

After discussing with your colleague on the live chat, here is what you need to do for a request where the response will be gzip.

The gzip:true option is not documented anywhere, which is why I was pulling my hair out!!

I have also added headers, although not sure if needed.

Many thanks to your colleague for saving my sanity!!

To anyone else having this issue, I hope this helps. I have also posted on stackoverflow : http://stackoverflow.com/questions/39149683/parse-cloud-httprequest-response-gzip-inflation-decompression


```
Parse.Cloud.httpRequest({
     
     headers: { 
          'Content-Type': 'application/xml',
          'Accept-Encoding': 'gzip, deflate' 
     },
     gzip:true,
     success: function (httpResponse) {
          ...
     },
     error: function (httpResponse) {
          ...
     }
}
```
Reply all
Reply to author
Forward
0 new messages