Added separateArrayItems: true to XML generation for responses with lists

This commit is contained in:
Jonathan Barrow
2023-04-26 11:17:48 -04:00
parent c243347adb
commit d68f0c37d9
5 changed files with 7 additions and 7 deletions

View File

@@ -66,7 +66,7 @@ router.get('/', async function (request: express.Request, response: express.Resp
});
}
response.send(xmlbuilder.create(json).end({ pretty: true, allowEmpty: true }));
response.send(xmlbuilder.create(json, { separateArrayItems: true }).end({ pretty: true, allowEmpty: true }));
});
router.get('/popular', async function (_request: express.Request, response: express.Response): Promise<void> {
@@ -194,7 +194,7 @@ router.get('/:communityID/posts', async function (request: express.Request, resp
});
}
response.send(xmlbuilder.create(json).end({ pretty: true, allowEmpty: true }));
response.send(xmlbuilder.create(json, { separateArrayItems: true }).end({ pretty: true, allowEmpty: true }));
});
// Handler for POST on '/v1/communities'

View File

@@ -259,7 +259,7 @@ router.get('/', async function (request: express.Request, response: express.Resp
request_name: 'friend_messages',
posts: postBody
}
}).end({ pretty: true }));
}, { separateArrayItems: true }).end({ pretty: true }));
});
router.post('/:post_id/empathies', upload.none(), async function (_request: express.Request, response: express.Response): Promise<void> {

View File

@@ -94,7 +94,7 @@ router.get('/', async function (request: express.Request, response: express.Resp
});
}
response.send(xmlbuilder.create(json).end({ pretty: true, allowEmpty: true }));
response.send(xmlbuilder.create(json, { separateArrayItems: true }).end({ pretty: true, allowEmpty: true }));
});
router.get('/:pid/following', async function (request: express.Request, response: express.Response): Promise<void> {
@@ -131,7 +131,7 @@ router.get('/:pid/following', async function (request: express.Request, response
});
}
response.send(xmlbuilder.create(json).end({ pretty: true, allowEmpty: true }));
response.send(xmlbuilder.create(json, { separateArrayItems: true }).end({ pretty: true, allowEmpty: true }));
});
export default router;

View File

@@ -154,7 +154,7 @@ router.get('/:post_id/replies', async function (request: express.Request, respon
});
}
response.send(xmlbuilder.create(json).end({ pretty: true, allowEmpty: true }));
response.send(xmlbuilder.create(json, { separateArrayItems: true }).end({ pretty: true, allowEmpty: true }));
});
router.get('/', async function (request: express.Request, response: express.Response): Promise<void> {

View File

@@ -98,7 +98,7 @@ async function generateTopicsXML(communities: HydratedCommunityDocument[]): Prom
json.result.topics.push(topic);
}
return xmlbuilder.create(json).end({ pretty: true, allowEmpty: true });
return xmlbuilder.create(json, { separateArrayItems: true }).end({ pretty: true, allowEmpty: true });
}
async function calculateMostPopularCommunities(hours: number, limit: number): Promise<HydratedCommunityDocument[]> {