@gravity-ui/gateway 4.9.0 → 4.10.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/README.md CHANGED
@@ -257,6 +257,8 @@ The `extra` parameter contains additional information about the request:
257
257
  - `protopath`: The proto path (for gRPC actions)
258
258
  - `protokey`: The proto key (for gRPC actions)
259
259
 
260
+ When accessing headers, the gateway first tries to get the header with the exact case provided by the user. If the header doesn't exist with that exact case, it falls back to looking for the same header name in lowercase. This behavior ensures compatibility with various HTTP clients that might send headers with different casing.
261
+
260
262
  You can set headers for a specific action using `ApiServiceBaseActionConfig.proxyHeaders`:
261
263
 
262
264
  ```javascript
@@ -116,7 +116,10 @@ function createMetadata({ options, actionConfig, config, params, serviceName, pr
116
116
  }
117
117
  for (const headerName of proxyHeaders) {
118
118
  if (metadata[headerName] === undefined) {
119
- metadata[headerName] = headers[headerName];
119
+ metadata[headerName] =
120
+ headers[headerName] !== undefined
121
+ ? headers[headerName]
122
+ : headers[headerName.toLowerCase()];
120
123
  }
121
124
  }
122
125
  const authHeaders = ((_b = (_a = config.getAuthHeaders) !== null && _a !== void 0 ? _a : serviceSchema === null || serviceSchema === void 0 ? void 0 : serviceSchema.getAuthHeaders) !== null && _b !== void 0 ? _b : options.getAuthHeaders)({
@@ -133,7 +133,10 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
133
133
  }
134
134
  for (const headerName of proxyHeaders) {
135
135
  if (actionHeaders[headerName] === undefined) {
136
- actionHeaders[headerName] = requestHeaders[headerName];
136
+ actionHeaders[headerName] =
137
+ requestHeaders[headerName] !== undefined
138
+ ? requestHeaders[headerName]
139
+ : requestHeaders[headerName.toLowerCase()];
137
140
  }
138
141
  }
139
142
  if (requestId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/gateway",
3
- "version": "4.9.0",
3
+ "version": "4.10.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "build/index.js",