Skip to content

Commit

Permalink
Fix bug with JSON Doctype #120
Browse files Browse the repository at this point in the history
  • Loading branch information
KostLinux committed Mar 26, 2024
1 parent 728a823 commit 38d6b5b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions api/dnssec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ const handler = async (domain) => {
});

res.on('end', () => {
resolve(JSON.parse(data));
try {
resolve(JSON.parse(data));
} catch (error) {
reject(new Error('Invalid JSON response'));
}
});

res.on('error', error => {
Expand All @@ -50,5 +54,4 @@ const handler = async (domain) => {
};

module.exports = middleware(handler);
module.exports.handler = middleware(handler);

module.exports.handler = middleware(handler);

0 comments on commit 38d6b5b

Please sign in to comment.