Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE11: ajax.getJSON returns string response #6532

Closed
johnhunter opened this issue Jul 22, 2021 · 3 comments
Closed

IE11: ajax.getJSON returns string response #6532

johnhunter opened this issue Jul 22, 2021 · 3 comments
Assignees
Labels
7.x Issues and PRs for version 7.x bug Confirmed bug

Comments

@johnhunter
Copy link

johnhunter commented Jul 22, 2021

Bug Report

Current Behavior
With IE11 ajax.getJSON returns the response string

Expected behavior
With IE11 ajax.getJSON should return an object as other browsers do

Reproduction

** Please provide repro code does not involves framework, or other setups to address this bug is specific to rxjs core **

// Global rxjs from unpkg.com/[email protected]/dist/bundles/rxjs.umd.js
var ajax = rxjs.ajax.ajax;

var url = 'https://api.github.com/users?per_page=2';

var users = ajax.getJSON(url);
var subscribe = users.subscribe(
  function(res) { console.log(typeof res, res) },
  function(err) { console.error(err) }
);
  • IE11 typeof res is "string"
  • Chrome typeof res is "object" as expected

Environment

  • Runtime: Browser IE11
  • RxJS version: 7.2.0
@benlesh
Copy link
Member

benlesh commented Jul 22, 2021

Seems like a workaround would be to check the type and JSON.parse:

const obj = typeof res === 'string' ? JSON.parse(res) : res;

@benlesh benlesh added the AGENDA ITEM Flagged for discussion at core team meetings label Jul 22, 2021
@johnhunter
Copy link
Author

Thanks @benlesh. I know that all IE support will be removed in v8 but do you think this regression will be patched in v7?

From PR #5661 it looks like this might have always been the behaviour with v7 (we were upgrading from 6.x.x).

@benlesh benlesh added 7.x Issues and PRs for version 7.x bug Confirmed bug and removed AGENDA ITEM Flagged for discussion at core team meetings labels Aug 11, 2021
@benlesh benlesh self-assigned this Aug 11, 2021
@johnhunter
Copy link
Author

Closing, version 8 is almost out and I no longer have to support IE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7.x Issues and PRs for version 7.x bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

2 participants