JSON parsing in API endpoints

This commit is contained in:
Alicia Sykes
2024-05-18 15:01:52 +01:00
parent cc510bd281
commit cb8db0b1f5
3 changed files with 7 additions and 5 deletions

View File

@ -12,13 +12,13 @@ const tlsHandler = async (url) => {
if (typeof scanId !== 'number') {
return {
statusCode: 500,
body: JSON.stringify({ error: 'Failed to get scan_id from TLS Observatory' }),
body: { error: 'Failed to get scan_id from TLS Observatory' },
};
}
const resultResponse = await axios.get(`${MOZILLA_TLS_OBSERVATORY_API}/results?id=${scanId}`);
return {
statusCode: 200,
body: JSON.stringify(resultResponse.data),
body: resultResponse.data,
};
} catch (error) {
return { error: error.message };