Created
October 18, 2017 09:35
-
-
Save JamesTheHacker/d70ea51e47bd6d2479db54795f422a5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = async function misconfiguredCORS(url, test) { | |
let headers = null; | |
try { | |
const result = await request | |
.get(url) | |
.set('Access-Control-Allow-Origin', test) | |
.timeout(5000) | |
if('access-control-allow-origin' in result.headers) { | |
headers = { | |
page: url, | |
data: result.headers | |
} | |
} | |
} catch (e) { | |
return null; | |
} | |
return headers; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment