MCPcopy
hub / github.com/Snailclimb/JavaGuide / algoliaRequest

Function algoliaRequest

scripts/docsearch-index.mjs:38–51  ·  view source on GitHub ↗
(path, body, method = "POST")

Source from the content-addressed store, hash-verified

36 .slice(0, 80);
37
38async function algoliaRequest(path, body, method = "POST") {
39 const response = await fetch(`${algoliaHost}${path}`, {
40 method,
41 headers: algoliaHeaders,
42 body: JSON.stringify(body),
43 });
44
45 if (!response.ok) {
46 const text = await response.text();
47 throw new Error(`Algolia request failed ${response.status}: ${text}`);
48 }
49
50 return response.json();
51}
52
53async function fetchText(url) {
54 const response = await fetch(url, {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected