@middy/http-content-encoding 7.1.0 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.d.ts +7 -1
- package/index.js +2 -3
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<h1>Middy http-content-encoding middleware</h1>
|
|
2
|
+
<h1>Middy `http-content-encoding` middleware</h1>
|
|
3
3
|
<img alt="Middy logo" src="https://raw.githubusercontent.com/middyjs/middy/main/docs/img/middy-logo.svg"/>
|
|
4
4
|
<p><strong>HTTP content encoding middleware for the middy framework, the stylish Node.js middleware engine for AWS Lambda</strong></p>
|
|
5
5
|
<p>
|
package/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import type middy from "@middy/core";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export type ContentEncoding = "br" | "deflate" | "gzip" | "zstd";
|
|
6
|
+
|
|
7
|
+
export interface Options {
|
|
6
8
|
br?: any;
|
|
7
9
|
gzip?: any;
|
|
8
10
|
deflate?: any;
|
|
@@ -10,6 +12,10 @@ interface Options {
|
|
|
10
12
|
overridePreferredEncoding?: string[];
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
export declare function getContentEncodingStream(
|
|
16
|
+
preferredEncoding: ContentEncoding,
|
|
17
|
+
): ReturnType<typeof import("node:zlib")["createGzip"]>;
|
|
18
|
+
|
|
13
19
|
declare function httpContentEncoding(options?: Options): middy.MiddlewareObj;
|
|
14
20
|
|
|
15
21
|
export default httpContentEncoding;
|
package/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
// Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
3
4
|
import { Readable } from "node:stream";
|
|
4
5
|
import { ReadableStream } from "node:stream/web";
|
|
5
|
-
|
|
6
6
|
import {
|
|
7
7
|
createBrotliCompress as brotliCompressStream,
|
|
8
8
|
createDeflate as deflateCompressStream,
|
|
9
9
|
createGzip as gzipCompressStream,
|
|
10
10
|
createZstdCompress as zstdCompressStream,
|
|
11
11
|
} from "node:zlib";
|
|
12
|
-
|
|
13
12
|
import { normalizeHttpResponse } from "@middy/util";
|
|
14
13
|
|
|
15
14
|
const contentEncodingStreams = {
|
|
@@ -128,7 +127,7 @@ const httpContentEncodingMiddleware = (opts) => {
|
|
|
128
127
|
};
|
|
129
128
|
};
|
|
130
129
|
|
|
131
|
-
// header in
|
|
130
|
+
// header in official name, lowercase variant handled
|
|
132
131
|
const addHeaderPart = (response, header, value) => {
|
|
133
132
|
const headerLower = header.toLowerCase();
|
|
134
133
|
const sanitizedHeader = response.headers[headerLower] ? headerLower : header;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/http-content-encoding",
|
|
3
|
-
"version": "7.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.1.1",
|
|
4
|
+
"description": "HTTP content encoding middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=22"
|
|
@@ -68,11 +68,13 @@
|
|
|
68
68
|
"url": "https://github.com/sponsors/willfarrell"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@middy/util": "7.1.
|
|
71
|
+
"@middy/util": "7.1.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@datastream/core": "0.0.42",
|
|
75
|
-
"@middy/core": "7.1.
|
|
75
|
+
"@middy/core": "7.1.1",
|
|
76
|
+
"@types/aws-lambda": "^8.0.0",
|
|
77
|
+
"@types/node": "^22.0.0"
|
|
76
78
|
},
|
|
77
79
|
"gitHead": "7a6c0fbb8ab71d6a2171e678697de9f237568431"
|
|
78
80
|
}
|