enhancement: 4423 switch sending back data from server to res.json() instead of res.send()

changeset
This commit is contained in:
NHI TRAN
2021-02-19 14:05:27 -05:00
parent ca559171bf
commit f43192207a
14 changed files with 57 additions and 39 deletions
@@ -63,7 +63,7 @@ export async function createRouter({
entityName,
);
res.send(techdocsMetadata);
res.json(techdocsMetadata);
} catch (err) {
logger.error(
`Unable to get metadata for ${entityName.namespace}/${entityName.name} with error ${err}`,
@@ -89,7 +89,7 @@ export async function createRouter({
).json()) as Entity;
const locationMetadata = getLocationForEntity(entity);
res.send({ ...entity, locationMetadata });
res.json({ ...entity, locationMetadata });
} catch (err) {
logger.info(
`Unable to get metadata for ${kind}/${namespace}/${name} with error ${err}`,
@@ -112,8 +112,7 @@ export async function createRouter({
const catalogRes = await fetch(`${catalogUrl}/entities/by-name/${triple}`);
if (!catalogRes.ok) {
const catalogResText = await catalogRes.text();
res.status(catalogRes.status);
res.send(catalogResText);
res.status(catalogRes.status).json(catalogResText);
return;
}