Compare commits

...

2 Commits

Author SHA1 Message Date
Brendan Allan
51d5bccd34 make error more descriptive 2026-04-08 10:57:07 +08:00
Brendan Allan
2b4a093da3 sdk: throw error if response has text/html content type 2026-04-08 10:57:07 +08:00

View File

@@ -77,6 +77,12 @@ export function createOpencodeClient(config?: Config & { directory?: string; exp
workspace: config?.experimental_workspaceID,
}),
)
const result = new OpencodeClient({ client })
return result
client.interceptors.response.use((response) => {
const contentType = response.headers.get("content-type")
if (contentType === "text/html")
throw new Error("Request is not supported by this version of OpenCode Server (Server responded with text/html)")
return response
})
return new OpencodeClient({ client })
}