@middy/http-content-negotiation 7.2.3 → 7.3.0
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/index.d.ts +4 -0
- package/index.js +21 -1
- package/package.json +3 -6
package/index.d.ts
CHANGED
|
@@ -34,4 +34,8 @@ declare function httpContentNegotiation(
|
|
|
34
34
|
options?: Options,
|
|
35
35
|
): middy.MiddlewareObj<unknown, unknown, Error>;
|
|
36
36
|
|
|
37
|
+
export declare function httpContentNegotiationValidateOptions(
|
|
38
|
+
options?: Record<string, unknown>,
|
|
39
|
+
): void;
|
|
40
|
+
|
|
37
41
|
export default httpContentNegotiation;
|
package/index.js
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
// Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
-
import { createError } from "@middy/util";
|
|
3
|
+
import { createError, validateOptions } from "@middy/util";
|
|
4
|
+
|
|
5
|
+
const optionSchema = {
|
|
6
|
+
parseCharsets: "boolean?",
|
|
7
|
+
availableCharsets: "array?",
|
|
8
|
+
defaultToFirstCharset: "boolean?",
|
|
9
|
+
parseEncodings: "boolean?",
|
|
10
|
+
availableEncodings: "array?",
|
|
11
|
+
defaultToFirstEncoding: "boolean?",
|
|
12
|
+
parseLanguages: "boolean?",
|
|
13
|
+
availableLanguages: "array?",
|
|
14
|
+
defaultToFirstLanguage: "boolean?",
|
|
15
|
+
parseMediaTypes: "boolean?",
|
|
16
|
+
availableMediaTypes: "array?",
|
|
17
|
+
defaultToFirstMediaType: "boolean?",
|
|
18
|
+
failOnMismatch: "boolean?",
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const httpContentNegotiationValidateOptions = (options) =>
|
|
22
|
+
validateOptions("@middy/http-content-negotiation", optionSchema, options);
|
|
23
|
+
|
|
4
24
|
import charset from "negotiator/lib/charset.js";
|
|
5
25
|
import encoding from "negotiator/lib/encoding.js";
|
|
6
26
|
import language from "negotiator/lib/language.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/http-content-negotiation",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "HTTP content negotiation middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -17,9 +17,6 @@
|
|
|
17
17
|
"import": {
|
|
18
18
|
"types": "./index.d.ts",
|
|
19
19
|
"default": "./index.js"
|
|
20
|
-
},
|
|
21
|
-
"require": {
|
|
22
|
-
"default": "./index.js"
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
22
|
},
|
|
@@ -65,11 +62,11 @@
|
|
|
65
62
|
"url": "https://github.com/sponsors/willfarrell"
|
|
66
63
|
},
|
|
67
64
|
"dependencies": {
|
|
68
|
-
"@middy/util": "7.
|
|
65
|
+
"@middy/util": "7.3.0",
|
|
69
66
|
"negotiator": "1.0.0"
|
|
70
67
|
},
|
|
71
68
|
"devDependencies": {
|
|
72
|
-
"@middy/core": "7.
|
|
69
|
+
"@middy/core": "7.3.0",
|
|
73
70
|
"@types/aws-lambda": "^8.0.0",
|
|
74
71
|
"@types/node": "^22.0.0"
|
|
75
72
|
}
|