@aws-sdk/middleware-host-header 3.186.0 → 3.190.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/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.190.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.189.0...v3.190.0) (2022-10-17)
7
+
8
+ **Note:** Version bump only for package @aws-sdk/middleware-host-header
9
+
10
+
11
+
12
+
13
+
14
+ # [3.188.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.187.0...v3.188.0) (2022-10-13)
15
+
16
+ **Note:** Version bump only for package @aws-sdk/middleware-host-header
17
+
18
+
19
+
20
+
21
+
6
22
  # [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
7
23
 
8
24
  **Note:** Version bump only for package @aws-sdk/middleware-host-header
package/dist-es/index.js CHANGED
@@ -1,38 +1,30 @@
1
- import { __awaiter, __generator } from "tslib";
2
1
  import { HttpRequest } from "@aws-sdk/protocol-http";
3
2
  export function resolveHostHeaderConfig(input) {
4
3
  return input;
5
4
  }
6
- export var hostHeaderMiddleware = function (options) {
7
- return function (next) {
8
- return function (args) { return __awaiter(void 0, void 0, void 0, function () {
9
- var request, _a, handlerProtocol;
10
- return __generator(this, function (_b) {
11
- if (!HttpRequest.isInstance(args.request))
12
- return [2, next(args)];
13
- request = args.request;
14
- _a = (options.requestHandler.metadata || {}).handlerProtocol, handlerProtocol = _a === void 0 ? "" : _a;
15
- if (handlerProtocol.indexOf("h2") >= 0 && !request.headers[":authority"]) {
16
- delete request.headers["host"];
17
- request.headers[":authority"] = "";
18
- }
19
- else if (!request.headers["host"]) {
20
- request.headers["host"] = request.hostname;
21
- }
22
- return [2, next(args)];
23
- });
24
- }); };
25
- };
5
+ export const hostHeaderMiddleware = (options) => (next) => async (args) => {
6
+ if (!HttpRequest.isInstance(args.request))
7
+ return next(args);
8
+ const { request } = args;
9
+ const { handlerProtocol = "" } = options.requestHandler.metadata || {};
10
+ if (handlerProtocol.indexOf("h2") >= 0 && !request.headers[":authority"]) {
11
+ delete request.headers["host"];
12
+ request.headers[":authority"] = "";
13
+ }
14
+ else if (!request.headers["host"]) {
15
+ request.headers["host"] = request.hostname;
16
+ }
17
+ return next(args);
26
18
  };
27
- export var hostHeaderMiddlewareOptions = {
19
+ export const hostHeaderMiddlewareOptions = {
28
20
  name: "hostHeaderMiddleware",
29
21
  step: "build",
30
22
  priority: "low",
31
23
  tags: ["HOST"],
32
24
  override: true,
33
25
  };
34
- export var getHostHeaderPlugin = function (options) { return ({
35
- applyToStack: function (clientStack) {
26
+ export const getHostHeaderPlugin = (options) => ({
27
+ applyToStack: (clientStack) => {
36
28
  clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions);
37
29
  },
38
- }); };
30
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-host-header",
3
- "version": "3.186.0",
3
+ "version": "3.190.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -20,8 +20,8 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/protocol-http": "3.186.0",
24
- "@aws-sdk/types": "3.186.0",
23
+ "@aws-sdk/protocol-http": "3.190.0",
24
+ "@aws-sdk/types": "3.190.0",
25
25
  "tslib": "^2.3.1"
26
26
  },
27
27
  "engines": {