@inferencesh/sdk 0.6.19 → 0.6.20
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/dist/proxy/index.js +11 -3
- package/package.json +1 -1
package/dist/proxy/index.js
CHANGED
|
@@ -95,14 +95,22 @@ export async function processProxyRequest(adapter, options) {
|
|
|
95
95
|
error: "Missing INFERENCE_API_KEY environment variable",
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
// 4. Collect
|
|
98
|
+
// 4. Collect headers to forward upstream.
|
|
99
|
+
//
|
|
100
|
+
// x-inf-* plus the SDK's own headers. X-API-Version is load-bearing: the
|
|
101
|
+
// API returns bare DTOs when it sees "2" and the legacy {success, status,
|
|
102
|
+
// data} envelope otherwise, and this SDK only parses the former. Dropping
|
|
103
|
+
// it here made every proxied response unparseable — requests succeeded
|
|
104
|
+
// server-side while the client silently saw nothing.
|
|
105
|
+
const FORWARD_HEADERS = ["x-api-version", "x-client-source"];
|
|
99
106
|
const forwardHeaders = {};
|
|
100
107
|
const allHeaders = adapter.headers();
|
|
101
108
|
for (const [key, value] of Object.entries(allHeaders)) {
|
|
102
|
-
|
|
109
|
+
const lower = key.toLowerCase();
|
|
110
|
+
if (lower.startsWith("x-inf-") || FORWARD_HEADERS.includes(lower)) {
|
|
103
111
|
const v = firstValue(value);
|
|
104
112
|
if (v)
|
|
105
|
-
forwardHeaders[
|
|
113
|
+
forwardHeaders[lower] = v;
|
|
106
114
|
}
|
|
107
115
|
}
|
|
108
116
|
// 5. Build request headers
|