vlsi commented on code in PR #6389: URL: https://github.com/apache/jmeter/pull/6389#discussion_r1881635608
########## src/core/src/main/java/org/apache/jmeter/samplers/SampleResult.java: ########## @@ -791,6 +801,27 @@ public void setResponseData(final String response, final String encoding) { * @return the responseData value (cannot be null) */ public byte[] getResponseData() { + if (responseData == null) { + return EMPTY_BA; + } + if (contentEncoding != null && responseData.length > 0) { + try { + switch (contentEncoding.toLowerCase(Locale.ROOT)) { + case "gzip": + return decompressGzip(responseData); + case "x-gzip": + return decompressGzip(responseData); + case "deflate": + return decompressDeflate(responseData); + case "br": + return decompressBrotli(responseData); + default: + return responseData; + } + } catch (IOException e) { + log.warn("Failed to decompress response data", e); + } + } Review Comment: Have you considered something like `interface ResponseDecoder { String decode(byte[] contents); }` or `interface Response { String toString(); byte[] toByteArray(); }`? Then there could be something like `SampleResult#setResponse(Response)` or `SampleResult#setResponseDecoder(ResponseDecoder)`? It just does not sound quite right to tie `SampleResult` with specific implementations of the decoding -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@jmeter.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org