You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 28, 2020. It is now read-only.
First of all, thank you for this awesome library. It's exactly what I was looking for!
Now I'm trying to get fincanceReports without any success! The response is a-gzip encoded and I don't know how to decode it by using nodes zlib module. I'm getting the error: Error: unexpected end of file. This is the adjusted code of the request:
async function call(api, path, method, options = {}) {
let rawResponse;
try {
rawResponse = await got_1.default(path, {
baseUrl: api.baseUrl,
method,
decompress: true,
headers:
{
'Authorization': "Bearer" + api.token",
'Accept': '*/*',
'Content-Type': 'application/a-gzip',
'Accept-Encoding' : 'agzip, deflate',
},
query: query(options.query),
body: options.body && JSON.stringify(options.body),
});
}
catch (error) {
throw new Error(error.response.body);
}
try {
var buffer = [];
var gunzip = zlib.createGunzip();
rawResponse.pipe(gunzip);
gunzip.on('data', function(data) {
// decompression chunk ready, add it to the buffer
console.log(data.toString());
buffer.push(data.toString())
}).on("end", function() {
// response and decompression complete, join the buffer and return
buffer.join("");
console.log(buffer);
}).on("error", function(e) {
console.log(e);
})
}
catch (jsonError) {
throw jsonError;
}
return json;
}
When I test the request with Postman I get the same response but I can then download the file over postman's UI and get a file.txt.gz. When I unzip that, I get a readable text file with the financeReport.
Do you have any idea what I am missing here?
The text was updated successfully, but these errors were encountered:
I just put out a change in 0.2.1 that should make it easier to consume the compressed data. appstoreconnect will return a Buffer when hitting one of the two gzip endpoints. Could you try it out?
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
First of all, thank you for this awesome library. It's exactly what I was looking for!
Now I'm trying to get fincanceReports without any success! The response is a-gzip encoded and I don't know how to decode it by using nodes zlib module. I'm getting the error:
Error: unexpected end of file
. This is the adjusted code of the request:When I test the request with Postman I get the same response but I can then download the file over postman's UI and get a file.txt.gz. When I unzip that, I get a readable text file with the financeReport.
Do you have any idea what I am missing here?
The text was updated successfully, but these errors were encountered: