Comments (8)
Good catch, looking into it
from http.
Hmm just tested this with a gzip response and it works fine for me. The docs for HTTPURLConnection
even say this automatically handles gzip:
Any other specifics about your setup that might be causing this to fail?
from http.
Hm i wasn't sure also about that when I read docs and what other users talk in the stackoverfow and when I added this fix the data had been decoded correctly. I need more tests to do this. One thing I also changed is my "Accept-Encoding" header changed from "gzip, br, deflate" to "gzip" could be that multiple accept parameters caused this bug. I will try to test it as soon as I can reach my code and will let you know!
from http.
Will test this with custom headers, maybe they are overwriting somehow
from http.
Hi, i tested it with multiple headers and when you put headers: {"Accept-Encoding": "gzip"} in the headers list and server is configured to return gzip compressed response then the lib doesn't decode data automatically. You have to decode stream your self. The problem disappears if you remove this header and server doesn't compress data. It's kind of not like a bug but more like a feature if user explicitly wants compressed data for example if returned data is a very big json response then yes compressing and decompressing is needed otherwise you can just scrip this header and you're good to go. Thanx for looking into this!
P.S IF it's not hard you can put simple check for this that other users don't get lost about it. It does nothing harm. Here is what i used: in buildResponse function
InputStream stream = (errorStream != null ? errorStream : conn.getInputStream()); String encoding = conn.getContentEncoding(); if (encoding != null && encoding.contains("gzip")) { stream = new GZIPInputStream(stream); } BufferedReader in = new BufferedReader(new InputStreamReader(stream));
from http.
Thanks! Just so I understand, if you remove this header and the server does compress the data, it works for you, yes?
Because that worked fine for me.
from http.
If your remove this header server won't compress the data that's how nginx or apache works. Unless some custom addon used or something. Data is compressed only then when asked.
from http.
BuildResponse now does catch IOException 😄. Closing this as the issue appears to be fixed in the capacitor-v3
branch
from http.
Related Issues (20)
- if http is not maintained, then what is the recommended plugin? HOT 2
- Allow fragments to be parsed as JSON in response data
- Could not cast value of type '__NSCFNumber' (0x10881b608) to 'NSString' (0x1f473fc40). HOT 1
- Allow WebDAV HTTP methods
- Sending request on background HOT 2
- Setup custom values in header not work.
- Request to https domain fails with SSLHandshakeException. HOT 5
- cannot overwrite default request headers on ios
- JSONException on device when getting a primitive value, e.g. number
- [feat] support metadata for uploadFile HOT 1
- downloadFile method not working correctly on Android
- Http progress listener has serious performance issue on Android HOT 3
- Cannot get cookies in the response
- iOS and Android handle form-uurlencoded requests differently HOT 2
- How to write interceptor in capacitor http HOT 1
- https url is not hitting with http-community in IONIC React. HOT 1
- Capacitor v4 support? HOT 4
- setCookie: "errorMessage":"Must provide value"
- Capacitor 4 : Http urls not working (only https) HOT 2
- Unable to open asset URL on Android
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http.