Skip to content

(bug): httpClient is automatically parsing error responses to string since 4.4.0-RC.0 #19103

@rafaelss95

Description

@rafaelss95

I'm submitting a...


[ X ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

When a post (I've only tested this method) request returns an error, like this:

{
  "base": [{
    "error": "something invalid"
  }]
}

... the error is parsed to string even the server returns a valid JSON as above.

Expected behavior

The error response shouldn't be parsed to string.

Minimal reproduction of the problem with instructions

http://plnkr.co/edit/IjmDdiM0BwFJlpk1JLkR?p=info

Just click "Send post" and take a look in the console (specifically in error... it's parsed to string).

Environment

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.4.0
node: 8.1.1
os: linux x64
@angular/animations: 4.4.0-RC.0
@angular/cdk: 2.0.0-beta.10
@angular/common: 4.4.0-RC.0
@angular/compiler: 4.4.0-RC.0
@angular/core: 4.4.0-RC.0
@angular/forms: 4.4.0-RC.0
@angular/http: 4.4.0-RC.0
@angular/material: 2.0.0-beta.10
@angular/platform-browser: 4.4.0-RC.0
@angular/platform-browser-dynamic: 4.4.0-RC.0
@angular/platform-server: 4.4.0-RC.0
@angular/router: 4.4.0-RC.0
@angular/cli: 1.4.0
@angular/compiler-cli: 4.4.0-RC.0
@angular/language-service: 4.4.0-RC.0
typescript: 2.5.2

Others:
It was working on 4.3.6 as you can see here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: common/httpIssues related to HTTP and HTTP ClientregressionIndicates than the issue relates to something that worked in a previous version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions