mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
Apply PR #11378: feat(opencode): gzip compress session messages response for 97% smaller payload
This commit is contained in:
@@ -579,6 +579,17 @@ export const SessionRoutes = lazy(() =>
|
||||
sessionID: c.req.valid("param").sessionID,
|
||||
limit: query.limit,
|
||||
})
|
||||
const acceptEncoding = c.req.header("accept-encoding") ?? ""
|
||||
if (acceptEncoding.includes("gzip")) {
|
||||
const json = JSON.stringify(messages)
|
||||
const compressed = Bun.gzipSync(json)
|
||||
return new Response(compressed, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Encoding": "gzip",
|
||||
},
|
||||
})
|
||||
}
|
||||
return c.json(messages)
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user