cancel
Showing results for 
Search instead for 
Did you mean: 

Get Transaction Response-MLE Encoding issue

Hello,

Following behavior has been observed with "Get Transaction by ID" REST API:

https://{CYBERSOURCE.ENVIRONMENT}/tss/v2/transactions/{id}

The Issue:
When requesting Response-MLE (via v-c-response-mle-kid in the JWT authorization token) with Accept-Encoding: gzip, the Get Transaction API returns a Content-Encoding: gzip response header, but the payload is an uncompressed JSON string rather than GZip-compressed data.
When Response-MLE is not requested with Accept-Encoding: gzip, the response body is properly GZip-encoded as expected.

Errors observed:

1) Postman - incorrect header check

2) SFCC javascript - java.util.zip.ZipException: Not in GZIP format

3) Git Bash cUrl: (23) client returned ERROR on write of 1361 bytes

4) Javascript Fetch:

TypeError: terminated
at Fetch.onAborted (node:internal/deps/undici/undici:13933:53)
at Fetch.emit (node:events:514:28)
at Fetch.terminate (node:internal/deps/undici/undici:13063:14)
at Object.onError (node:internal/deps/undici/undici:14067:38)
at Gunzip.emit (node:events:526:24)
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
[cause]: Error: incorrect header check
at genericNodeError (node:internal/errors:986:15)
at wrappedFn (node:internal/errors:540:14)
at Zlib.zlibOnError [as onerror] (node:zlib:197:13) {
errno: -3,
code: 'Z_DATA_ERROR'
}
}

5) PowerShell Script with RestMethod

Invoke-RestMethod : The magic number in GZip header is not correct. Make sure you are passing in a GZip stream.

6) PowerShell Script with System.Net.Http.HttpClient

  • A non-encrypted response is returned as GZip, which the client processes as expected.
  • When an encrypted response is requested with "Accept-Encoding: gzip", the response contains "Content-Encoding: gzip"; however, the actual body is a JSON string.

>>>>>>>>>>>>>>

The fix that resolves this issue on client side is to update request headers, so instead of
"Accept-Encoding: gzip"
to ensure the client sends:
"Accept-Encoding: identity"
that tells the server:
"Send the response in its original, uncompressed form. Do not apply content encoding such as gzip, br (Brotli), or deflate."

Hope that helps!

PS: not sure if other APIs are impacted.

 

 

velizarn
Member
0 REPLIES 0