angular2-rc4- text/plain 在给定 x-www-form-urlencoded 时自动附加到内容类型中

angular2-rc4- text/plain is automatically getting appended in content type when x-www-form-urlencoded given

我正在使用带有 spring 其余部分的 angular2-rc4。我正在使用 spring 身份验证。
Spring 身份验证期望 content-type 为 application/x-www-form-urlencoded; charset=UTF-8 和 post 纯字符串格式的数据,如 "j_username=user&j_password=pass".
所以我写了下面的代码:

let data = 'j_username=user&j_password=password'; //Spring authentication expects data in this format.
let headers = new Headers({'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8'});
let options = new RequestOptions({headers: headers});
 this.http.post(url, data, options).subscribe(
.....
....
);

当我通过 firefox 执行这段代码时,它没有任何问题。数据正在到达服务器并且身份验证工作正常。
但是当我从 chrome 执行时,它不起作用。用户名和密码正在以空值到达服务器。
我在 firebug 的帮助下比较了 chrome 和 firefox 的请求 header。我注意到一个不同之处。 content-type 在 firefox 中运行正常,但在 chrome 中运行不正常。以下是 chrome 和 firefox 的内容类型:
Firefox: Content-type: application/x-www-form-urlencoded;字符集=UTF-8
Chrome : Content-type: test/plain, application/x-www-form-urlencoded;字符集=UTF-8

如果您看到 chrome 自动将 text/plain 附加到其 header。我不明白这背后的原因。
注意:此代码适用于 angular2-rc1。升级到 rc4 后开始遇到问题。
请帮忙
谢谢

我从 2 天起就一直在为这个问题苦苦挣扎,就在发布这个问题之后,我在 angular2-rc4 代码中得到了解决方案。我在这里发布解决方案,以便它可以帮助其他人。
我更改了我的代码,如下所示,它开始工作了: From: let headers = new Headers({'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}); 收件人: 让 headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');

但我仍然不确定之前的代码在 firefox 中是如何工作的。