MCPcopy Create free account
hub / github.com/isomorphic-git/isomorphic-git / stringifyBody

Function stringifyBody

src/managers/GitRemoteHTTP.js:35–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 * @returns {{ preview: string, response: string, data: Buffer }}
34 */
35const stringifyBody = async res => {
36 try {
37 // Some services provide a meaningful error message in the body of 403s like "token lacks the scopes necessary to perform this action"
38 const data = Buffer.from(await collect(res.body))
39 const response = data.toString('utf8')
40 const preview =
41 response.length < 256 ? response : response.slice(0, 256) + '...'
42 return { preview, response, data }
43 } catch (e) {
44 return {}
45 }
46}
47
48export class GitRemoteHTTP {
49 /**

Callers 2

discoverMethod · 0.85
connectMethod · 0.85

Calls 4

collectFunction · 0.90
sliceMethod · 0.80
fromMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…