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

@ -2,6 +2,8 @@ import dns from 'dns';
import URL from 'url-parse';
import middleware from './_common/middleware.js';
// TODO: Fix.
const mailConfigHandler = async (url, event, context) => {
try {
const domain = new URL(url).hostname || new URL(url).pathname;
@ -70,7 +72,7 @@ const mailConfigHandler = async (url, event, context) => {
} else {
return {
statusCode: 500,
body: JSON.stringify({ error: error.message }),
body: { error: error.message },
};
}
}