MCPcopy Create free account
hub / github.com/editablejs/editable / callbackRequest

Function callbackRequest

packages/yjs-websocket/src/server/callback.ts:34–58  ·  view source on GitHub ↗
(url: URL, timeout: number, data: any)

Source from the content-addressed store, hash-verified

32}
33
34const callbackRequest = (url: URL, timeout: number, data: any) => {
35 data = JSON.stringify(data)
36 const options: http.RequestOptions = {
37 hostname: url.hostname,
38 port: url.port,
39 path: url.pathname,
40 timeout,
41 method: 'POST',
42 headers: {
43 'Content-Type': 'application/json',
44 'Content-Length': data.length,
45 },
46 }
47 const req = http.request(options)
48 req.on('timeout', () => {
49 console.warn('Callback request timed out.')
50 req.abort()
51 })
52 req.on('error', e => {
53 console.error('Callback request error.', e)
54 req.abort()
55 })
56 req.write(data)
57 req.end()
58}
59
60const getContent = (
61 objName: string,

Callers 1

callbackHandlerFunction · 0.85

Calls 1

onMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…