aws / aws/aws-lambda-nodejs-runtime-interface-client

Function URL with Response Streaming does not support Content-Encoding

未關閉
#96 1 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
TypeScript
星號
224
分支
60
PR 合併指標
30 天內沒有已合併 PR

描述

If I compress my response using `gzip` and set a proper `Content-Encoding` response header, it appears like Function URL will decompress my response on-the-fly, remove the `Content-Encoding` header, and pass down the uncompressed response stream. This is wasteful and unnecessary.

```js
const pipeline = require("util").promisify(require("stream").pipeline);
const { Readable } = require("stream");
const zlib = require('zlib');

exports.handler = awslambda.streamifyResponse(async (event,
responseStream, context) => {
responseStream = awslambda.HttpResponseStream.from(responseStream, {
statusCode: 200,
headers: {
'content-encoding': 'gzip',
'content-type': 'text/plain',
}
});

await pipeline(
Readable.from(zlib.gzipSync('hello world')),
responseStream,
);
});
```

See here - the response is uncompressed, with `Content-Encoding` header stripped:

![ss](https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/assets/10402560/984abcb7-b4d9-4402-b96d-ccbf9f30bb64)

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。