How Pako library can gzip a request and send the GZIP_MAGIC that it can identify the request has been compress with gzip

134 Views Asked by At

This is application in Angular and Java.

Tha angular is compressing the request with pako library, like this :

  var compressedBody = pako.gzip(JSON.stringify(request.body))
  const clone = request.clone({ headers: request.headers.append('Content-Encoding', 'gzip'), body: compressedBody });

When the Backend is reading the request -> The request is compress but it doesn't come the GZIP_MAGIC to identify the body has been request in gzip, so it's not unzip the request.

Can anybody know how to send the request in pako that I can receive the GXIP_MAGIC?

Thanks

CheckedInputStream in = new CheckedInputStream(this_in, crc);
crc.reset();
// Check header magic
if (readUShort(in) != GZIP_MAGIC) {
    throw new ZipException("Not in GZIP format");
}

readUShort(in) is 8752 and it should be GZIP_MAGIC=35615

0

There are 0 best solutions below