Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python tornado中的CORS仅发送选项请求_Python_Cors_Httprequest_Tornado - Fatal编程技术网

python tornado中的CORS仅发送选项请求

python tornado中的CORS仅发送选项请求,python,cors,httprequest,tornado,Python,Cors,Httprequest,Tornado,首先,我读到了这个问题: 我所做的是: 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")

首先,我读到了这个问题:
我所做的是:

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")
还有一种选择方法:

def options(self):
    self.set_status(204)
    self.finish()
在我的处理程序中:

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!')
我是这样要求的:

function del(){
    $.rest.put(
        "http://xxx.xxx.xxx.xxx:7777/amir_test",
        {user: "A",pass: "b"}, 
        function (data) {console.log(data);}
    );
}
问题是,当我向这个url发出请求时,在inspector的“网络”选项卡中只有一个选项,没有put请求。我该怎么办


访问控制仅允许
标题仅适用于
GET
(以及一些
POST
)请求。对于其他方法,
选项
请求是必需的。您必须实现链接问题的答案中所示的
options()

我已经完成了,但忘记在此处复制,问题已更新,但结果相同!现在怎么办?您的
访问控制允许方法
需要包括您支持的所有方法(在本例中包括PUT和DELETE)