feat(Headers): implement `toJSON`

This commit is contained in:
gdi2290 2015-12-09 20:56:32 -08:00 committed by vsavkin
parent 2ca5e38a78
commit 0cb32c2fef
1 changed files with 13 additions and 1 deletions

View File

@ -1,4 +1,11 @@
import {isPresent, isBlank, isJsObject, isType, StringWrapper} from 'angular2/src/facade/lang'; import {
isPresent,
isBlank,
isJsObject,
isType,
StringWrapper,
Json
} from 'angular2/src/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
import { import {
isListLikeIterable, isListLikeIterable,
@ -120,6 +127,11 @@ export class Headers {
*/ */
values(): string[][] { return MapWrapper.values(this._headersMap); } values(): string[][] { return MapWrapper.values(this._headersMap); }
/**
* Returns string of all headers.
*/
toJSON(): string { return Json.stringify(this.values()); }
/** /**
* Returns list of header values for a given name. * Returns list of header values for a given name.
*/ */