Skip to content

Commit

Permalink
Merge pull request #121 from KostLinux/FIX/json-doctype
Browse files Browse the repository at this point in the history
Fix bug with JSON Doctype
  • Loading branch information
Lissy93 authored Apr 20, 2024
2 parents d7bcbcb + 38d6b5b commit c9631e6
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 c9631e6

Please sign in to comment.