feat: add server link sharing
This commit is contained in:
parent
ec8eea7cbe
commit
7698a5e6ac
25 changed files with 1586 additions and 1194 deletions
|
|
@ -6,6 +6,7 @@ test("exposes every standard HTTP API group", () => {
|
|||
|
||||
expect(Object.keys(client)).toEqual([
|
||||
"health",
|
||||
"server",
|
||||
"location",
|
||||
"agent",
|
||||
"plugin",
|
||||
|
|
@ -45,6 +46,21 @@ test("exposes every standard HTTP API group", () => {
|
|||
expect(Object.keys(client.project)).toEqual(["list", "current", "directories"])
|
||||
})
|
||||
|
||||
test("server.get uses the public HTTP contract", async () => {
|
||||
let request: Request | undefined
|
||||
const client = OpenCode.make({
|
||||
baseUrl: "http://localhost:3000",
|
||||
fetch: async (input) => {
|
||||
request = input instanceof Request ? input : new Request(input)
|
||||
return Response.json({ urls: ["http://192.168.1.10:4096"] })
|
||||
},
|
||||
})
|
||||
|
||||
expect(await client.server.get()).toEqual({ urls: ["http://192.168.1.10:4096"] })
|
||||
expect(request?.method).toBe("GET")
|
||||
expect(request?.url).toBe("http://localhost:3000/api/server")
|
||||
})
|
||||
|
||||
test("MCP resource catalog uses the public HTTP contract", async () => {
|
||||
let request: Request | undefined
|
||||
const client = OpenCode.make({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue