@gravity-ui/gateway 4.9.0 → 4.10.1
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 +2 -0
- package/build/components/grpc.js +4 -1
- package/build/components/rest.js +4 -1
- package/package.json +2 -2
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
|
package/build/components/grpc.js
CHANGED
|
@@ -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] =
|
|
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)({
|
package/build/components/rest.js
CHANGED
|
@@ -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] =
|
|
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.
|
|
3
|
+
"version": "4.10.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"test-integration-no-server": "jest --colors --config=jest.config-integration.js"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@grpc/grpc-js": "
|
|
42
|
+
"@grpc/grpc-js": "1.12.6",
|
|
43
43
|
"@grpc/proto-loader": "^0.7.8",
|
|
44
44
|
"ajv": "^8.12.0",
|
|
45
45
|
"axios": "^1.8.3",
|