* 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 },
)
| 94 | * @returns {object} Data fetched from endpoint |
| 95 | */ |
| 96 | async 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 | |
| 113 | export { validateEndpointData, fetchEndpointData } |
no test coverage detected