Failed to decode gzip: Failed to decompress data: gzip: invalid header JAVASCRIPT

The response doesn’t need to be encoded as hex, it needs to be raw bytes. I think removing toString("hex") should do the trick (haven’t tried this, would recommend checking code examples)