Auto-infer to text/plain

This commit is contained in:
Tat Dat Duong
2025-01-24 15:50:49 +01:00
parent dfe907ca3a
commit 9407dabf71
2 changed files with 16 additions and 1 deletions
+15
View File
@@ -18,6 +18,21 @@ import { store as graphStore } from "./storage/store.mjs";
const app = new Hono();
// This is used to match the behavior of the original LangGraph API
// where the content-type is not being validated. Might be nice
// to warn about this in the future and throw an error instead.
app.use(async (c, next) => {
if (
c.req.header("content-type")?.startsWith("text/plain") &&
c.req.method !== "GET" &&
c.req.method !== "OPTIONS"
) {
c.req.raw.headers.set("content-type", "application/json");
}
await next();
});
app.use(cors());
app.use(requestLogger());
+1 -1
View File
@@ -2240,7 +2240,7 @@ describe("multitasking", () => {
});
});
describe.only("RemoteGraph", () => {
describe("RemoteGraph", () => {
it.concurrent("stream values", async () => {
const graph = new RemoteGraph({
graphId: "agent",