Skip to content

response Type is set to wrong one(json) when the actual response is a string with Content-Type "text/plain" #155

@PrasadRasapally

Description

@PrasadRasapally

I'm submitting a bug report

  • Library Version:
    0.11.0

Please tell us about your environment:

  • Operating System:
    Windows [7] professional

  • Node Version:
    4.6.1

  • NPM Version:
    3.8.9

  • JSPM OR Webpack AND Version
    JSPM 0.16.32

  • Browser:
    IE 11

  • Language:
    ESNext(ES - 6), angularjs

Current behavior:
In IE-11 the headers.headers['Content-Type'] of HttpResponseMessage is always being undefined. So the response type is set to wrong one(json), Even if I am getting the response from the server as a string with content-type text/plain. So getting "invalid character" Error when tried to parse the string response#151

 if (this.responseType === 'json') {
        this._content = JSON.parse(this.response, this.reviver);
        return this._content;
  }

Expected/desired behavior:

  • What is the expected behavior?
    It should not parse the response when the response is a string with content-type text/plain. So as to prevent the "Invalid character" error in IE-11.
  • What is the motivation / use case for changing the behavior?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions