# HeaderMatch

Used to generate header matching methods.

- Source: [`aws-appmesh/lib/header-match.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-appmesh/lib/header-match.ts#L17)

## Example

```ts
declare const router: appmesh.VirtualRouter;
declare const node: appmesh.VirtualNode;

router.addRoute('route-http2', {
  routeSpec: appmesh.RouteSpec.http2({
    weightedTargets: [
      {
        virtualNode: node,
      },
    ],
    match: {
      path: appmesh.HttpRoutePathMatch.exactly('/exact'),
      method: appmesh.HttpRouteMethod.POST,
      protocol: appmesh.HttpRouteProtocol.HTTPS,
      headers: [
        // All specified headers must match for the route to match.
        appmesh.HeaderMatch.valueIs('Content-Type', 'application/json'),
        appmesh.HeaderMatch.valueIsNot('Content-Type', 'application/json'),
      ],
      queryParameters: [
        // All specified query parameters must match for the route to match.
        appmesh.QueryParameterMatch.valueIs('query-field', 'value')
      ],
    },
  }),
});
```

## Initializer

```ts
new HeaderMatch()
```

## Methods

- `bind(scope: Construct): HeaderMatchConfig` — Returns the header match configuration.

- `valueDoesNotEndWith(headerName: string, suffix: string): HeaderMatch // chainable` (static) — The value of the header with the given name in the request must not end with the specified characters.

  **Parameters**

  - `headerName` — the name of the header to match against.
  - `suffix` — The suffix to test against.

- `valueDoesNotMatchRegex(headerName: string, regex: string): HeaderMatch // chainable` (static) — The value of the header with the given name in the request must not include the specified characters.

  **Parameters**

  - `headerName` — the name of the header to match against.
  - `regex` — The regex to test against.

- `valueDoesNotStartWith(headerName: string, prefix: string): HeaderMatch // chainable` (static) — The value of the header with the given name in the request must not start with the specified characters.

  **Parameters**

  - `headerName` — the name of the header to match against.
  - `prefix` — The prefix to test against.

- `valueEndsWith(headerName: string, suffix: string): HeaderMatch // chainable` (static) — The value of the header with the given name in the request must end with the specified characters.

  **Parameters**

  - `headerName` — the name of the header to match against.
  - `suffix` — The suffix to test against.

- `valueIs(headerName: string, headerValue: string): HeaderMatch // chainable` (static) — The value of the header with the given name in the request must match the specified value exactly.

  **Parameters**

  - `headerName` — the name of the header to match against.
  - `headerValue` — The exact value to test against.

- `valueIsNot(headerName: string, headerValue: string): HeaderMatch // chainable` (static) — The value of the header with the given name in the request must not match the specified value exactly.

  **Parameters**

  - `headerName` — the name of the header to match against.
  - `headerValue` — The exact value to test against.

- `valueMatchesRegex(headerName: string, regex: string): HeaderMatch // chainable` (static) — The value of the header with the given name in the request must include the specified characters.

  **Parameters**

  - `headerName` — the name of the header to match against.
  - `regex` — The regex to test against.

- `valuesIsInRange(headerName: string, start: number, end: number): HeaderMatch // chainable` (static) — The value of the header with the given name in the request must be in a range of values.

  **Parameters**

  - `headerName` — the name of the header to match against.
  - `start` — Match on values starting at and including this value.
  - `end` — Match on values up to but not including this value.

- `valuesIsNotInRange(headerName: string, start: number, end: number): HeaderMatch // chainable` (static) — The value of the header with the given name in the request must not be in a range of values.

  **Parameters**

  - `headerName` — the name of the header to match against.
  - `start` — Match on values starting at and including this value.
  - `end` — Match on values up to but not including this value.

- `valueStartsWith(headerName: string, prefix: string): HeaderMatch // chainable` (static) — The value of the header with the given name in the request must start with the specified characters.

  **Parameters**

  - `headerName` — the name of the header to match against.
  - `prefix` — The prefix to test against.
