405角色js发布到web服务(firefox)

以下代码可以正常使用Internet Explorer并收到200响应。 但是,使用Firefox会生成405.使用fiddler时,我可以看到IE传递了json对象,但firefox没有。

app.service('UserService', function ($http) {
    this.GetLoginStatus = function (AuthenticateRequest) {
        $http.defaults.useXDomain = true;
        $http({
            url: APIURL + '/Authenticate',
            method: "POST",
            options: {},
            data: AuthenticateRequest,
            headers: {'Content-Type': 'application/json'}
        }).success(function (data, status, headers, config) {
            console.log(data);
            console.log(status);
            console.log(headers);
            console.log(config);
        }).error(function (data, status, headers, config) {
            console.log(data);
            console.log(status);
            console.log(headers);
            console.log(config);
        });
    }; 
});

Fiddler检查FireFox OPTIONS http://www.myapi.com:56586/V1/Service.svc/json/Authenticate HTTP / 1.1主机:localhost:56586用户代理:Mozilla / 5.0(Windows NT 6.3; WOW64; rv:28.0 )Gecko / 20100101 Firefox / 28.0接受:text / html,application / xhtml + xml,application / xml; q = 0.9,/; q = 0.8 Accept-Language:en-US,en; q = 0.5 Accept-Encoding:gzip ,deflate原点:http://www.myapi.com:54567访问控制请求方法:POST访问控制请求头文件:content-type,x-requested-with连接:keep-alive Pragma:no-缓存Cache-Control:无缓存

IE POST http://www.myapi.com:56586/V1/Service.svc/json/Authenticate HTTP / 1.1 X-Requested-With:XMLHttpRequest Accept:application / json,text / plain,/ Content-Type:application / json Referer:http://www.myapi.com:54567/ Accept-Language:en-US,en; q = 0.5 Accept-Encoding:gzip,deflate User-Agent:Mozilla / 5.0(Windows NT 6.3; WOW64; Trident /7.0; Touch; rv:11.0)像Gecko主机:localhost:56586内容长度:45 DNT:1连接:Keep-Alive Pragma:no-cache

{ “用户名”: “用户名”, “密码”: “密码”}

链接地址: http://www.djcxy.com/p/46245.html

上一篇: 405 angular js posting to web service (firefox)

下一篇: jquery $.ajax custom http headers issue