SHARE
TWEET

Untitled

a guest Aug 12th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @route('/<:re:.*>', method='OPTIONS')
  2. def enable_cors_generic_route():
  3.     add_cors_headers()
  4.  
  5.  
  6. @hook('before_request')
  7. def enable_cors_after_request_hook():
  8.     add_cors_headers()
  9.  
  10.  
  11. def add_cors_headers():
  12.     if True:
  13.         response.headers['Access-Control-Allow-Origin'] = '*'
  14.         response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, OPTIONS'
  15.         response.headers['Access-Control-Allow-Headers'] = \
  16.             'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token'
RAW Paste Data
Top