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

fix: xhr request error with blob urls (closes #2634) #2737

Merged
merged 2 commits into from Feb 21, 2022

Conversation

kirillsalikhov
Copy link
Contributor

Purpose

Fixes error with xhr request when pass blob as url

Approach

Adding check for reqOpts variable existence in send method override

// src/client/sandbox/xhr.ts

        overrideFunction(xmlHttpRequestProto, 'send', function (this: XMLHttpRequest, ...args: Parameters<XMLHttpRequest['send']>) {
            //...
            const reqOpts = XhrSandbox.REQUESTS_OPTIONS.get(this);
            
            if (reqOpts && reqOpts.withCredentials !== this.withCredentials)
                XhrSandbox._reopenXhr(this, reqOpts);
            //...
        });

References

#2634

Pre-Merge TODO

  • Write tests for your proposed changes
  • Make sure that existing tests do not fail

@viktoria2506
Copy link

Thank you for your contribution to TestCafe. We will review this PR.

Copy link
Contributor

@miherlosev miherlosev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kirillsalikhov

It's better to add the executed XHR request to REQUESTS_OPTIONS here.

@miherlosev miherlosev temporarily deployed to authentication February 21, 2022 08:58 Inactive
@miherlosev miherlosev linked an issue Feb 21, 2022 that may be closed by this pull request
@miherlosev miherlosev temporarily deployed to CI February 21, 2022 08:59 Inactive
@miherlosev miherlosev merged commit 72fe9e6 into DevExpress:master Feb 21, 2022
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

Successfully merging this pull request may close these issues.

Error when requesting blob object urls through XHR
3 participants