aurelia / http-client

A simple, restful, message-based wrapper around XMLHttpRequest.
MIT License
62 stars 59 forks source link

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

Open PrasadRasapally opened 8 years ago

PrasadRasapally commented 8 years ago

I'm submitting a bug report

Please tell us about your environment:

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:

PrasadRasapally commented 8 years ago

The language is ECMA Script 6.

EisenbergEffect commented 8 years ago

Submit a PR for the fix, but only if you can reliably determine the content type to be text. The PR should not change the default behavior in other scenarios.

Alexander-Taran commented 2 years ago

@bigopon

async triageQuestion(id) =>{
 respondSameDay()
 let response = await getResponseFromOP( { timeout : fromYears(6) } )
 if(!response) {
    closeQuestion(id,randomReason())
 }
}

also.. IE.EOL == true