First of all I've read this question:
Tornado server: enable CORS requests
What I did is:
class BaseHandler(RequestHandler):
def set_default_headers(self, *args, **kwargs):
self.set_header("Access-Control-Allow-Origin", "*")
self.set_header("Access-Control-Allow-Headers", "x-requested-with")
self.set_header("Access-Control-Allow-Methods", "POST, GET, OPTIONS")
And also an option method:
def options(self):
self.set_status(204)
self.finish()
And in my handler:
class AmirTest(BaseHandler):
def get(self, *args, **kwargs):
self.write('You have requested get method!')
def post(self, *args, **kwargs):
self.write('You have requested post method!')
def put(self, *args, **kwargs):
self.write('You have requested put method!')
def delete(self, *args, **kwargs):
self.write('You have requested delete method!')
This is how I request:
function del(){
$.rest.put(
"http://xxx.xxx.xxx.xxx:7777/amir_test",
{user: "A",pass: "b"},
function (data) {console.log(data);}
);
}
The problem is when I made a request this url, in the network tab of inspector there is only an option and no put request. what should I do?