Guest User

Untitled

a guest
Oct 18th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. module.exports = async function misconfiguredCORS(url, test) {
  2. let headers = null;
  3. try {
  4. const result = await request
  5. .get(url)
  6. .set('Access-Control-Allow-Origin', test)
  7. .timeout(5000)
  8.  
  9. if('access-control-allow-origin' in result.headers) {
  10. headers = {
  11. page: url,
  12. data: result.headers
  13. }
  14. }
  15. } catch (e) {
  16. return null;
  17. }
  18. return headers;
  19. }
Add Comment
Please, Sign In to add comment