Skip to content

Instantly share code, notes, and snippets.

@JamesTheHacker
Created October 18, 2017 09:35
Show Gist options
  • Save JamesTheHacker/d70ea51e47bd6d2479db54795f422a5e to your computer and use it in GitHub Desktop.
Save JamesTheHacker/d70ea51e47bd6d2479db54795f422a5e to your computer and use it in GitHub Desktop.
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