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

Major issue with this library breaking on Safari #54

Closed
badddams opened this issue Jul 3, 2023 · 4 comments
Closed

Major issue with this library breaking on Safari #54

badddams opened this issue Jul 3, 2023 · 4 comments

Comments

@badddams
Copy link

badddams commented Jul 3, 2023

Hi there,

We recently upgraded to the newer version 8.2.3 but since upgrading, all POST requests using URL Search Params seem to be sending the data across in JSON as opposed to Form Data like they were previously. Because of this, it causes the browser to break in Safari and post an error.

I was only able to catch this by going through each of my dependencies and finding the root cause.

Thanks in advance but will hardcode our version to 8.1.1 for now as this seems to keep things working.

@jerrybendy
Copy link
Owner

I tried on Safari 15.6.1, and it works well. Could you make a demo to show this issue ?

var a = new URLSearchParams({a: 1, b: 2})
fetch('/', {body: a, method: 'POST'})

image

@badddams
Copy link
Author

badddams commented Jul 4, 2023

Hey @jerrybendy thanks for getting back to me, I'm using it in this context.

var params = new URLSearchParams();

params.append('inputname', 'jerry');

axios.post(url, params, config);

I appreciate that I'm not using fetch like in your example above but prior to this update, it all worked perfectly.

@jerrybendy
Copy link
Owner

I got your problem and fixed it. You can try v8.2.4.

Axios using toString.call to check an object is URLSearchParams or not. So when Proxy is not used, toString.call reteruns an incorrect value. This triggers this issue.

Another mistake is checking useProxy conditions returns an incorrect value. Safari 15 should use Proxy, but the code returns false.

@badddams
Copy link
Author

badddams commented Jul 7, 2023

Amazing, great work @jerrybendy thanks for resolving so quickly!

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