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

Invalid JSONP response - Error shows DOCTYPE HTML code #116

Open
Sebbo94BY opened this issue Dec 23, 2022 · 1 comment
Open

Invalid JSONP response - Error shows DOCTYPE HTML code #116

Sebbo94BY opened this issue Dec 23, 2022 · 1 comment

Comments

@Sebbo94BY
Copy link

Sebbo94BY commented Dec 23, 2022

Since a few hours, I have the problem, that the below code snippet...

$.ajax({
	type: "GET",
	url: "https://api.allorigins.win/get?url=" + encodeURIComponent("https://www.teamspeak.com/versions/client.json"),
	dataType: "json",
        [...]
});

...fails with this error:

Uncaught SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
    at JSON.parse (<anonymous>)
    at Object.success ((index):1349:15)
    at c (jquery-3.6.0.min.js:2:28327)
    at Object.fireWith [as resolveWith] (jquery-3.6.0.min.js:2:29072)
    at l (jquery-3.6.0.min.js:2:79901)
    at XMLHttpRequest.<anonymous> (jquery-3.6.0.min.js:2:82355)

Is this maybe related to #115?

The code worked fine and as expected for the past months.

Could you please check, what's wrong here on the API side? Or did anything change?

@bulk88
Copy link

bulk88 commented Dec 28, 2022

I have the same problem in the last month, allorigins changed their Accept: header from something safe like, this is from IE 9,

    "Accept": "text/html, application/xhtml+xml, */*", 

to https://api.allorigins.win/raw?url=http://httpbin.org/get

    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",

and the application/xml triggers certain Java EE frameworks (Jackson for example) to deliver XML instead of JSON by default if its in the accept headerline.

bulk88 added a commit to bulk88/tinymta that referenced this issue Dec 28, 2022
-dont use allorigins for subway anymore, getting XML instead of JSON
 nowadays b/c Accept header can't be controlled
 gnuns/allOrigins#116

-dumb.js rmv dup line, from day 1 on blame
bulk88 added a commit to bulk88/tinymta that referenced this issue Nov 30, 2023
-dont use allorigins for subway anymore, getting XML instead of JSON
 nowadays b/c Accept header can't be controlled
 gnuns/allOrigins#116

-dumb.js rmv dup line, from day 1 on blame
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