Review duplicate header parameter names

Compare headers applied to the same request without regard to letter case.

Description

HTTP request header names are case-insensitive. Define token and Token once when they represent the same header on a request.

Potential impact

A generated client may assign two different values to the same header.

Remediation

Check which parameters each operation actually uses. If two values are required, use distinct header names the server recognizes and inspect the request the client sends.

Examples

These excerpts show path-level header parameters. They omit info, the operations and any authentication setup.

Before

json
{
  "openapi": "3.0.0",
  "paths": {
    "/": {
      "parameters": [
        {
          "name": "token",
          "in": "header",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "Token",
          "in": "header",
          "schema": {
            "type": "string"
          }
        }
      ]
    }
  }
}

After

json
{
  "openapi": "3.0.0",
  "paths": {
    "/": {
      "parameters": [
        {
          "name": "token",
          "in": "header",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "username",
          "in": "header",
          "schema": {
            "type": "string"
          }
        }
      ]
    }
  }
}

The second uses username only for a separate username value accepted by the server. If both entries mean the same token, remove the duplicate.

References