MCPcopy
hub / github.com/opentrace/opentrace / post

Method post

ui/src/store/serverStore.ts:123–136  ·  view source on GitHub ↗
(path: string, body: unknown)

Source from the content-addressed store, hash-verified

121 }
122
123 private async post<T>(path: string, body: unknown): Promise<T> {
124 const base = this.baseUrl.endsWith('/') ? this.baseUrl : this.baseUrl + '/';
125 const url = new URL(path.startsWith('/') ? path.slice(1) : path, base);
126 const res = await fetch(url.toString(), {
127 method: 'POST',
128 headers: { 'Content-Type': 'application/json' },
129 body: JSON.stringify(body),
130 });
131 if (!res.ok) {
132 const text = await res.text().catch(() => '');
133 throw new Error(`Server error ${res.status}: ${text}`);
134 }
135 return res.json() as Promise<T>;
136 }
137
138 // ---- GraphStore interface -------------------------------------------
139

Callers 12

indexUrlMethod · 0.95
traverseMethod · 0.95
clearGraphMethod · 0.95
server.tsFile · 0.80
test_outgoingMethod · 0.80
test_missing_nodeMethod · 0.80
test_missing_bodyMethod · 0.80
test_traverse_shapeMethod · 0.80

Calls 1

toStringMethod · 0.80

Tested by 8

test_outgoingMethod · 0.64
test_missing_nodeMethod · 0.64
test_missing_bodyMethod · 0.64
test_traverse_shapeMethod · 0.64