Closed blairkenneth closed 10 years ago
I'm sorry, I don't really understand the issue here. What are these "developer tools"? The chrome developer tools? What are you doing to "look at the response"? What's all this about Apache? Isn't this client side code? Why isn't the browser handling the gzip compression for you?
Perhaps your issue is attempting to use JSON on a third party site? Our API doesn't set CORS headers, so for now you need to use JSONP. I made a quick mock-up that seems to work: http://jsfiddle.net/aQt7U/
I have written an angularjs $http.get request as follows: $scope.getStreamList = function () { $http({ method: 'GET', url: 'https://api.twitch.tv/kraken/streams/featured', headers: {'Accept': 'application/vnd.twitchtv.v3+json'}, params: {client_id: 'MY CLIENT ID', limit: '1'} }).success(function (data, status) { $scope.streams = data; $scope.streamStatus = status; }).error(function (data, status){ $scope.streams = data; $scope.streamStatus = status; }); };
When I execute this on my page I get a 200 response back from the service. When I go into my developer tools to look at the response which should be JSON data I see an error with the following:
"SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
If you copy the request URL and paste into a browser you see the JSON data, if I setup the same request in SOAPUI it works fine, as soon as I run through my hosting at godaddy I get the error.
I think this is an Apache issue as the data is sent over as 'gzip' content-type, my Apache version is 2.4, mod_deflate is enabled.
Can someone help me resolve this issue?