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

Content-type Equality Check Problem #87

Closed
OmriAharon opened this issue May 21, 2018 · 3 comments
Closed

Content-type Equality Check Problem #87

OmriAharon opened this issue May 21, 2018 · 3 comments

Comments

@OmriAharon
Copy link

OmriAharon commented May 21, 2018

Would like to report a possible bug on this line.

We're using Cypress in our project, and as part of it we're mocking network requests by saving setup XHR responses as fixture files. One of those XHR requests is the LaunchDarkly GET request to get our feature flags.

However, since we now read a file to serve as a mock for the request, the content-type header as part of the response is added with charset=utf-8 which results in this value being: application/json; charset=utf-8, thus failing the said line above.

Do you see any problem in modifying the condition to:

const contentType = xhr.getResponseHeader('Content-type');
if (xhr.status === 200 && contentType && contentType.indexOf(json) > -1) {
    ...
}
@eli-darkly
Copy link
Contributor

Thanks for pointing that out - indeed, we shouldn't be relying on an exact match like that. We're working on getting a big JS release out soon and this could go into that - although if this is blocking your work right now, I can try to put out a smaller patch release sooner.

@OmriAharon
Copy link
Author

If you could do that it would be greatly appreciated!

@eli-darkly
Copy link
Contributor

Should be fixed now in the latest release.

atrakh added a commit that referenced this issue Jul 13, 2018
* Be more explicit about which files we export

* Update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants