-
Notifications
You must be signed in to change notification settings - Fork 27
Request to implement Accept-encoding: gzip header #318
Comments
Hi @dankox - you should be able to access the response headers via something like this: const client = new RestClient(session);
await client.performRest(...);
console.log(client.response.headers); // print or parse |
Hi @dkelosky , thanks for the suggestion. I didn't know we can access it like that. I will open issue on our repo to change some requests to this. Anyway, regarding this issue, I guess it's more up to you if you want to implement it or not. Lot of rest clients have it as default (that's why I spot it, as it was always slower thru nodejs than any other client I was using for tests), but on the other hand the question is if imperative should update your header without your knowledge or not. |
Thanks @dankox. Hopefully it's clear that other public methods beyond I think an enhancement is fine idea, especially if other clients have that by default. Along the lines, I hope to have #316 pushed soon :) . |
AbstractRestClient.performRest()
method should introduce an option (or maybe just do it by default) to include request headerAccept-encoding: gzip deflate
or something similar.It should also deal with the response, when it comes in such format by checking
content-encoding: gzip
orcontent-encoding: deflate
.This can be done by using
zlib
library and pipe-ing response to it, something like this:Currently it's not possible to do with the functionality provided by imperative, because we don't have access to response headers (or at least I don't know how) therefore not able to see if the response is compressed.
We either have to implement the whole HTTP request, or use default setup which means, the times for download from mainframe are bigger.
Just for comparison on Endevor Webservice, when using the default method for list elements, it will take over 1 minute for 8k elements, while with this implementation it will take something around 15-20 seconds.
Note: times can vary, depending on mainframe performance
The text was updated successfully, but these errors were encountered: