MCPcopy
hub / github.com/badges/shields / fetchEndpointData

Function fetchEndpointData

services/endpoint-common.js:96–111  ·  view source on GitHub ↗

* Fetches data from the endpoint and validates the data. * * @param {object} serviceInstance Instance of Endpoint class * @param {object} attrs Refer to individual attributes * @param {string} attrs.url Endpoint URL * @param {object} attrs.httpErrors Object containing error messages for differe

(
  serviceInstance,
  { url, httpErrors, validationPrettyErrorMessage, includeKeys },
)

Source from the content-addressed store, hash-verified

94 * @returns {object} Data fetched from endpoint
95 */
96async function fetchEndpointData(
97 serviceInstance,
98 { url, httpErrors, validationPrettyErrorMessage, includeKeys },
99) {
100 const json = await serviceInstance._requestJson({
101 schema: anySchema,
102 url,
103 httpErrors,
104 logErrors: [],
105 options: { decompress: true, timeout: { request: 3500 } },
106 })
107 return validateEndpointData(json, {
108 prettyErrorMessage: validationPrettyErrorMessage,
109 includeKeys,
110 })
111}
112
113export { validateEndpointData, fetchEndpointData }

Callers 1

handleMethod · 0.90

Calls 2

validateEndpointDataFunction · 0.85
_requestJsonMethod · 0.45

Tested by

no test coverage detected