MCPcopy Create free account
hub / github.com/Effect-TS/effect / probeStatus

Function probeStatus

packages/ui/devtools/test/DevToolsServer.test.ts:34–56  ·  view source on GitHub ↗
(
  url: string,
  options: {
    readonly method?: string
    readonly headers: Record<string, string>
  },
  body = ""
)

Source from the content-addressed store, hash-verified

32
33// happy-dom's fetch applies CORS, so the origin probes use node:http.
34const probeStatus = (
35 url: string,
36 options: {
37 readonly method?: string
38 readonly headers: Record<string, string>
39 },
40 body = ""
41) =>
42 Effect.promise(
43 () =>
44 new Promise<number>((resolve, reject) => {
45 const req = request(url, options, (res) => {
46 res.resume()
47 res.on("end", () => resolve(res.statusCode ?? 0))
48 })
49 req.on("upgrade", (res, socket) => {
50 socket.destroy()
51 resolve(res.statusCode ?? 0)
52 })
53 req.on("error", reject)
54 req.end(body)
55 })
56 )
57
58const makeAgent = Effect.fnUntraced(function*(base: string) {
59 const transport = yield* McpClient.http({

Callers 2

probeFunction · 0.85

Calls 6

resumeMethod · 0.65
onMethod · 0.65
endMethod · 0.65
requestFunction · 0.50
resolveFunction · 0.50
destroyMethod · 0.45

Tested by

no test coverage detected