Most extensions and inspectors need to access the decompressed/unchunked body bytes to perform their function, requiring them to have an understanding of how to get those decoded bytes. To simplify this, add UnencodedRequestBody and UnencodedResponseBody properties to Session that return a byte[], for example:
public byte[] UnencodedResponse() {
if (!_HasResponseBody() || !Utilities.HasHeaders(oResponse)) return Utilities.emptyByteArray;
if (oResponse.headers.ExistsAny(new[] { "Content-Encoding", "Transfer-Encoding" }))
{
arrResponse = Utilities.Dupe(mySession.responseBodyBytes);
Utilities.utilDecodeHTTPBody(mySession.ResponseHeaders, ref arrResponse);
}
else
{
arrResponse = mySession.responseBodyBytes;
}
}
GetRequestBodyAsString and GetResponseBodyAsString can then be refactored to call these byte[] properties.