MCPcopy Index your code
hub / github.com/github/docs / getJSON

Function getJSON

tests/helpers/e2etest.js:93–102  ·  view source on GitHub ↗
(route, opts)

Source from the content-addressed store, hash-verified

91// For use with the ?json query param
92// e.g. await getJSON('/en?json=breadcrumbs')
93export async function getJSON(route, opts) {
94 const res = await get(route, { ...opts, followRedirects: true })
95 if (res.status >= 500) {
96 throw new Error(`Server error (${res.status}) on ${route}`)
97 }
98 if (res.status >= 400) {
99 console.warn(`${res.status} on ${route} and the response might not be JSON`)
100 }
101 return JSON.parse(res.text)
102}

Callers 4

featured-links.jsFile · 0.90
breadcrumbs.jsFile · 0.90
products.jsFile · 0.90
versions.jsFile · 0.90

Calls 1

getFunction · 0.85

Tested by

no test coverage detected