feat(http): added withCredentials support

Taken into account the withCredentials property within the request options:
- added corresponding property in the RequestOptions class
- added corresponding property in the Request class
- handle this property when merging options
- set the withCredentials property on the XHR object when specified

Added a test in the xhr_backend_spec.ts to check that the property is actually
set on the XHR object

Closes https://github.com/angular/http/issues/65

Closes #7281

Closes #7281
This commit is contained in:
Thierry Templier
2016-02-24 22:57:35 +01:00
committed by Misko Hevery
parent 0f0a8ade7c
commit 95af14b97c
6 changed files with 40 additions and 4 deletions

View File

@ -59,6 +59,8 @@ export class Request {
private _body: any;
/** Type of the request body **/
private contentType: ContentType;
/** Enable use credentials */
withCredentials: boolean;
constructor(requestOptions: RequestArgs) {
// TODO: assert that url is present
let url = requestOptions.url;
@ -81,6 +83,7 @@ export class Request {
// Defaults to 'omit', consistent with browser
// TODO(jeffbcross): implement behavior
this.headers = new Headers(requestOptions.headers);
this.withCredentials = requestOptions.withCredentials;
}