fix(opencode): forward remote workspace request bodies (#29458)

This commit is contained in:
Kit Langton
2026-05-27 21:54:36 -04:00
committed by GitHub
parent ec26d78450
commit 7bafbb309a
4 changed files with 43 additions and 11 deletions

View File

@@ -4,17 +4,11 @@ import { HttpBody, HttpClient, HttpClientRequest, HttpServerRequest, HttpServerR
import * as Socket from "effect/unstable/socket/Socket"
import { WebSocketTracker } from "../websocket-tracker"
function webSource(request: HttpServerRequest.HttpServerRequest): Request | undefined {
return request.source instanceof Request ? request.source : undefined
}
function requestBody(request: HttpServerRequest.HttpServerRequest) {
if (request.method === "GET" || request.method === "HEAD") return HttpBody.empty
if (request.source instanceof Request && request.source.body === null) return HttpBody.empty
const len = request.headers["content-length"]
return HttpBody.raw(webSource(request)?.body ?? null, {
contentType: request.headers["content-type"],
contentLength: len ? Number(len) : undefined,
})
return HttpBody.stream(request.stream, request.headers["content-type"], len ? Number(len) : undefined)
}
export function websocket(