i wondering how can i get the Content-Length size when i call kuzzle.document.search
.
Any help?
Thanks
i wondering how can i get the Content-Length size when i call kuzzle.document.search
.
Any help?
Thanks
Unfortunately the content of the Content-Length
header is not directly available through the Javascript SDK.
You can either send a raw HTTP request to Kuzzle to get this header by yourself or you can approximately compute the total size of the response by hand:
let result = await sdk.document.search(...);
const contentLength = Buffer.from(JSON.stringify(result._response)).byteLength;
As I say in the comment, I will suggest this feature in our product workshop. I will keep you informed.