OPTION preflight to stackexchange api以BAD REQUEST响应

时间:2015-08-29 01:56:09

标签: stackexchange-api preflight http-options-method

我整天都在反对这一切。当我尝试从我的webapp发布到stackexchange时,我的请求会继续获得400 BAD REQUEST。我一直在使用提琴手试图欺骗请求,但我似乎无法让它通过。有谁知道原因是什么,以及我应该如何形成我的要求?

示例请求

OPTIONS https://api.stackexchange.com/2.2/questions/32262145/upvote?filter=default&key=9Gn[..the rest of key..]jMF*Q((&site=stackoverflow HTTP/1.1
Host: api.stackexchange.com
Connection: keep-alive
Access-Control-Request-Method: POST
Origin: [my site]
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36
Access-Control-Request-Headers: accept, content-type
Accept: */*
Referer: [the page on my site]
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,nb;q=0.6

响应

HTTP/1.1 400 Bad Request
Cache-Control: private
Content-Type: application/json; charset=utf-8
Content-Encoding: gzip
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Credentials: false
X-Content-Type-Options: nosniff
Date: Sat, 29 Aug 2015 

01:23:39 GMT
Content-Length: 95

使用JSON

JSON
  error_id=404
  error_message=this method cannot be called this way
  error_name=no_method

0 个答案:

没有答案