Thanks for reaching out to Microsoft Q&A.
The behavior you’re experiencing with Azure Data Factory (ADF) returning a compressed gzip response for API errors, while providing a normal JSON response for successful requests, can be attributed to how the API is configured to handle error responses.
- API Design: Some APIs are designed to return compressed responses for error messages to save bandwidth, especially if the error messages are lengthy or contain detailed stack traces. This might not be consistent across all endpoints or methods.
- Content-Encoding Header: When the API encounters an error, it might automatically apply gzip compression to the response. If the
Content-Encoding
header is set togzip
, ADF may not handle it correctly, leading to the compressed output you’re seeing. - Error Handling in ADF: ADF might not be configured to decompress gzip responses when an error occurs. This could be a limitation or a specific behavior of the Web Activity in ADF.
- Modify Request Headers: You might try adding an
Accept-Encoding: identity
header to your ADF request. This could instruct the server not to compress the response, allowing you to receive the error message in a readable format. - Post-Processing: If you continue to receive gzip responses, consider implementing a post-processing step in your pipeline to handle decompression. You could use Azure Functions or another service to decompress the response before further processing.
Hope this helps. Do let us know if you any further queries.