(url)
| 79 | |
| 80 | // Aggregate four threat-feed lookups; skip the card if every source failed |
| 81 | const threatsHandler = async (url) => { |
| 82 | const sources = await Promise.all([ |
| 83 | safeBrowsing(url), |
| 84 | urlHaus(url), |
| 85 | phishTank(url), |
| 86 | cloudmersive(url), |
| 87 | ]); |
| 88 | const [safe, haus, phish, cloud] = sources; |
| 89 | if (sources.every((s) => s?.error || s?.skipped)) { |
| 90 | return { skipped: 'No threat sources returned data for this host' }; |
| 91 | } |
| 92 | return { safeBrowsing: safe, urlHaus: haus, phishTank: phish, cloudmersive: cloud }; |
| 93 | }; |
| 94 | |
| 95 | export const handler = middleware(threatsHandler); |
| 96 | export default handler; |
nothing calls this directly
no test coverage detected