我正在尝试从java代码压缩lambda响应,但在浏览器中它无法解码
@Override
public Map handleRequest(Map<String,Object> input, Context context) {
Map<String, Object> repsonse = new HashMap<>();
HashMap<String, String> headers = new HashMap<>();
headers.put("Content-Encoding", "gzip");
headers.put("Content-Type", "text/html");
final String sampleHtml = "<h1>Hello World</h1>";
ByteArrayOutputStream out = new ByteArrayOutputStream();
GZIPOutputStream gzip = new GZIPOutputStream(out);
gzip.write(sampleHtml.getBytes());
gzip.close();
String responseString = out.toString("ISO-8859-1");
response.put("headers", headers);
response.put("body", responseString);
response.put("statusCode", 200);
response.put("isBase64Encoded", true);
return response;
}