【问题标题】:AngularJS $http DELETE request Content-Type headerAngularJS $http DELETE 请求 Content-Type 标头
【发布时间】:2013-09-04 15:54:49
【问题描述】:

当我使用 AngularJS $resource 模块发出 DELETE 请求时,Angular 会在请求标头中添加 Content-Type: application/xml 标头。在AngularJS source code 中,有一个部分在未发送参数时会删除 content-type 请求标头。但是,我不明白为什么会这样,这不起作用。

这是我提出删除请求的方式:

$resource('/my/topics/:topicId').remove({ topicId: 1}, successFn, errorFn

这是浏览器的标题

Accept:application/json, text/plain, */*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:0
Content-Type:application/xml
Cookie:session=0a627145415440740d6cc8cd35d19ba3; __ngDebug=true
Host:localhost:9001
Origin:http://localhost:9001
Referer:http://localhost:9001/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36

Content-Type 标头来自哪里?

编辑:我使用的是 AngularJS 1.2.0rc1

【问题讨论】:

标签: angularjs angularjs-resource


【解决方案1】:

我找到了解决方法:https://github.com/angular/angular.js/issues/2149#issuecomment-22664501

我希望有人将此修复合并到 angularjs master。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-13
    • 1970-01-01
    • 1970-01-01
    • 2013-07-05
    • 2014-03-09
    • 1970-01-01
    • 1970-01-01
    • 2021-02-12
    相关资源
    最近更新 更多