@aws-sdk/middleware-host-header 3.734.0 → 3.775.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/dist-cjs/index.js +7 -9
- package/dist-types/index.d.ts +15 -0
- package/package.json +5 -4
package/dist-cjs/index.js
CHANGED
|
@@ -19,22 +19,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
|
|
21
21
|
// src/index.ts
|
|
22
|
-
var
|
|
23
|
-
__export(
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
24
|
getHostHeaderPlugin: () => getHostHeaderPlugin,
|
|
25
25
|
hostHeaderMiddleware: () => hostHeaderMiddleware,
|
|
26
26
|
hostHeaderMiddlewareOptions: () => hostHeaderMiddlewareOptions,
|
|
27
27
|
resolveHostHeaderConfig: () => resolveHostHeaderConfig
|
|
28
28
|
});
|
|
29
|
-
module.exports = __toCommonJS(
|
|
29
|
+
module.exports = __toCommonJS(index_exports);
|
|
30
30
|
var import_protocol_http = require("@smithy/protocol-http");
|
|
31
31
|
function resolveHostHeaderConfig(input) {
|
|
32
32
|
return input;
|
|
33
33
|
}
|
|
34
34
|
__name(resolveHostHeaderConfig, "resolveHostHeaderConfig");
|
|
35
35
|
var hostHeaderMiddleware = /* @__PURE__ */ __name((options) => (next) => async (args) => {
|
|
36
|
-
if (!import_protocol_http.HttpRequest.isInstance(args.request))
|
|
37
|
-
return next(args);
|
|
36
|
+
if (!import_protocol_http.HttpRequest.isInstance(args.request)) return next(args);
|
|
38
37
|
const { request } = args;
|
|
39
38
|
const { handlerProtocol = "" } = options.requestHandler.metadata || {};
|
|
40
39
|
if (handlerProtocol.indexOf("h2") >= 0 && !request.headers[":authority"]) {
|
|
@@ -42,8 +41,7 @@ var hostHeaderMiddleware = /* @__PURE__ */ __name((options) => (next) => async (
|
|
|
42
41
|
request.headers[":authority"] = request.hostname + (request.port ? ":" + request.port : "");
|
|
43
42
|
} else if (!request.headers["host"]) {
|
|
44
43
|
let host = request.hostname;
|
|
45
|
-
if (request.port != null)
|
|
46
|
-
host += `:${request.port}`;
|
|
44
|
+
if (request.port != null) host += `:${request.port}`;
|
|
47
45
|
request.headers["host"] = host;
|
|
48
46
|
}
|
|
49
47
|
return next(args);
|
|
@@ -56,9 +54,9 @@ var hostHeaderMiddlewareOptions = {
|
|
|
56
54
|
override: true
|
|
57
55
|
};
|
|
58
56
|
var getHostHeaderPlugin = /* @__PURE__ */ __name((options) => ({
|
|
59
|
-
applyToStack: (clientStack) => {
|
|
57
|
+
applyToStack: /* @__PURE__ */ __name((clientStack) => {
|
|
60
58
|
clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions);
|
|
61
|
-
}
|
|
59
|
+
}, "applyToStack")
|
|
62
60
|
}), "getHostHeaderPlugin");
|
|
63
61
|
// Annotate the CommonJS export names for ESM import in node:
|
|
64
62
|
|
package/dist-types/index.d.ts
CHANGED
|
@@ -7,14 +7,29 @@ export interface HostHeaderInputConfig {
|
|
|
7
7
|
interface PreviouslyResolved {
|
|
8
8
|
requestHandler: RequestHandler<any, any>;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
10
13
|
export interface HostHeaderResolvedConfig {
|
|
11
14
|
/**
|
|
12
15
|
* The HTTP handler to use. Fetch in browser and Https in Nodejs.
|
|
13
16
|
*/
|
|
14
17
|
requestHandler: RequestHandler<any, any>;
|
|
15
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
16
22
|
export declare function resolveHostHeaderConfig<T>(input: T & PreviouslyResolved & HostHeaderInputConfig): T & HostHeaderResolvedConfig;
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
17
26
|
export declare const hostHeaderMiddleware: <Input extends object, Output extends object>(options: HostHeaderResolvedConfig) => BuildMiddleware<Input, Output>;
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
18
30
|
export declare const hostHeaderMiddlewareOptions: BuildHandlerOptions & AbsoluteLocation;
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
19
34
|
export declare const getHostHeaderPlugin: (options: HostHeaderResolvedConfig) => Pluggable<any, any>;
|
|
20
35
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-host-header",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.775.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline middleware-host-header",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"build:types": "tsc -p tsconfig.types.json",
|
|
10
10
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
11
11
|
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
|
|
12
|
+
"extract:docs": "api-extractor run --local",
|
|
12
13
|
"test": "yarn g:vitest run",
|
|
13
14
|
"test:integration": "yarn g:vitest run -c vitest.config.integ.ts",
|
|
14
15
|
"test:watch": "yarn g:vitest watch",
|
|
@@ -23,9 +24,9 @@
|
|
|
23
24
|
},
|
|
24
25
|
"license": "Apache-2.0",
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"@aws-sdk/types": "3.
|
|
27
|
-
"@smithy/protocol-http": "^5.0
|
|
28
|
-
"@smithy/types": "^4.
|
|
27
|
+
"@aws-sdk/types": "3.775.0",
|
|
28
|
+
"@smithy/protocol-http": "^5.1.0",
|
|
29
|
+
"@smithy/types": "^4.2.0",
|
|
29
30
|
"tslib": "^2.6.2"
|
|
30
31
|
},
|
|
31
32
|
"engines": {
|