@gethelio/proxy 0.11.0 → 0.11.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/dist/cli.js +8 -4
- package/dist/index.js +8 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1223,6 +1223,12 @@ function parseJsonRpcRequest(body) {
|
|
|
1223
1223
|
};
|
|
1224
1224
|
}
|
|
1225
1225
|
|
|
1226
|
+
// src/transport/content-type.ts
|
|
1227
|
+
function isJsonContentType(header) {
|
|
1228
|
+
const [essence = ""] = (header ?? "").split(";");
|
|
1229
|
+
return essence.trim().toLowerCase() === "application/json";
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1226
1232
|
// src/transport/forward-headers.ts
|
|
1227
1233
|
function buildForwardHeaders(requestHeaders, allowlist) {
|
|
1228
1234
|
const forwardHeaders = {};
|
|
@@ -1356,8 +1362,7 @@ function createStreamableHttpRoute(forwarder, options = {}) {
|
|
|
1356
1362
|
const app = new Hono();
|
|
1357
1363
|
const forwardHeaderAllowlist = options.forwardHeadersAllowlist ?? [];
|
|
1358
1364
|
app.post("/", async (c) => {
|
|
1359
|
-
|
|
1360
|
-
if (!contentType.includes("application/json")) {
|
|
1365
|
+
if (!isJsonContentType(c.req.header("content-type"))) {
|
|
1361
1366
|
return c.json(
|
|
1362
1367
|
makeJsonRpcError(null, INVALID_REQUEST, "Content-Type must be application/json"),
|
|
1363
1368
|
415
|
|
@@ -1490,8 +1495,7 @@ function createSseRoute(forwarder, options = {}) {
|
|
|
1490
1495
|
if (!session) {
|
|
1491
1496
|
return c.json(makeJsonRpcError(null, INVALID_REQUEST, "unknown session"), 404);
|
|
1492
1497
|
}
|
|
1493
|
-
|
|
1494
|
-
if (!contentType.includes("application/json")) {
|
|
1498
|
+
if (!isJsonContentType(c.req.header("content-type"))) {
|
|
1495
1499
|
return c.json(
|
|
1496
1500
|
makeJsonRpcError(null, INVALID_REQUEST, "Content-Type must be application/json"),
|
|
1497
1501
|
415
|
package/dist/index.js
CHANGED
|
@@ -1042,6 +1042,12 @@ function parseJsonRpcRequest(body) {
|
|
|
1042
1042
|
};
|
|
1043
1043
|
}
|
|
1044
1044
|
|
|
1045
|
+
// src/transport/content-type.ts
|
|
1046
|
+
function isJsonContentType(header) {
|
|
1047
|
+
const [essence = ""] = (header ?? "").split(";");
|
|
1048
|
+
return essence.trim().toLowerCase() === "application/json";
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1045
1051
|
// src/transport/forward-headers.ts
|
|
1046
1052
|
function buildForwardHeaders(requestHeaders, allowlist) {
|
|
1047
1053
|
const forwardHeaders = {};
|
|
@@ -1175,8 +1181,7 @@ function createStreamableHttpRoute(forwarder, options = {}) {
|
|
|
1175
1181
|
const app = new Hono();
|
|
1176
1182
|
const forwardHeaderAllowlist = options.forwardHeadersAllowlist ?? [];
|
|
1177
1183
|
app.post("/", async (c) => {
|
|
1178
|
-
|
|
1179
|
-
if (!contentType.includes("application/json")) {
|
|
1184
|
+
if (!isJsonContentType(c.req.header("content-type"))) {
|
|
1180
1185
|
return c.json(
|
|
1181
1186
|
makeJsonRpcError(null, INVALID_REQUEST, "Content-Type must be application/json"),
|
|
1182
1187
|
415
|
|
@@ -1309,8 +1314,7 @@ function createSseRoute(forwarder, options = {}) {
|
|
|
1309
1314
|
if (!session) {
|
|
1310
1315
|
return c.json(makeJsonRpcError(null, INVALID_REQUEST, "unknown session"), 404);
|
|
1311
1316
|
}
|
|
1312
|
-
|
|
1313
|
-
if (!contentType.includes("application/json")) {
|
|
1317
|
+
if (!isJsonContentType(c.req.header("content-type"))) {
|
|
1314
1318
|
return c.json(
|
|
1315
1319
|
makeJsonRpcError(null, INVALID_REQUEST, "Content-Type must be application/json"),
|
|
1316
1320
|
415
|