MCPcopy Index your code
hub / github.com/danvk/webdiff / getDiff

Function getDiff

ts/CodeDiffContainer.tsx:102–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

100 // It would be more correct to set contents=undefined here to get a loading state,
101 // but this produces an unnecessary flash for rapid transitions.
102 const getDiff = async () => {
103 const response = await fetch(`/diff/${filePair.idx}`, {
104 method: 'POST',
105 headers: {
106 Accept: 'application/json',
107 'Content-Type': 'application/json',
108 },
109 body: JSON.stringify({
110 options: gitDiffOptionsToFlags(diffOptions),
111 normalize_json: normalizeJSON,
112 }),
113 });
114 return response.json() as Promise<DiffRange[]>;
115 };
116
117 const {a, b} = filePair;
118 // Do XHRs for the contents of both sides in parallel and fill in the diff.

Callers 1

CodeDiffContainerFunction · 0.85

Calls 2

gitDiffOptionsToFlagsFunction · 0.90
fetchFunction · 0.85

Tested by

no test coverage detected