From 89f61087c7c856195c97cd4e269f2c186aca9209 Mon Sep 17 00:00:00 2001 From: Thierry Templier Date: Wed, 9 Mar 2016 14:35:49 +0100 Subject: [PATCH] feat(http): implement Response.prototype.toString() to make for a nicer error message Added a toString method to the Response class displaying status / status and the URL of the request. Closes: https://github.com/angular/http/issues/89 Closes #7511 --- modules/@angular/http/src/static_response.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/@angular/http/src/static_response.ts b/modules/@angular/http/src/static_response.ts index c0059eecad..9132f73725 100644 --- a/modules/@angular/http/src/static_response.ts +++ b/modules/@angular/http/src/static_response.ts @@ -114,4 +114,8 @@ export class Response { arrayBuffer(): any { throw new BaseException('"arrayBuffer()" method not implemented on Response superclass'); } + + toString(): string { + return `Response with status: ${this.status} ${this.statusText} for URL: ${this.url}`; + } }