Forked from victoroliv2/cross-site-xmlhttprequest.py
Created
September 29, 2018 13:25
-
-
Save myrual/e7a29621bea701a239690db1ceff1d7e to your computer and use it in GitHub Desktop.
web.py server which allow cross-site xmlhttprequest
This file contains hidden or 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
import web | |
urls = ( | |
'/(.*)', 'Service' | |
) | |
app = web.application(urls, globals()) | |
class Service: | |
def GET(self, name): | |
web.header('Access-Control-Allow-Origin', '*') | |
web.header('Access-Control-Allow-Credentials', 'true') | |
return {'message': GET OK!'} | |
def POST(self, name): | |
web.header('Access-Control-Allow-Origin', '*') | |
web.header('Access-Control-Allow-Credentials', 'true') | |
data = web.data() | |
return {'message': "POST OK! %s" % data} | |
if __name__ == "__main__": | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment