+1 vote

I am having problems with HttpRequest
When I reproduce my project on desktop it works ok and the value of result is 0; but when I play it in HTLM5 the result gives me 4 and does not read the data from the api.

func onHTTPRequestrequestcompleted(result, response code, headers, body):
print (result)

in Engine by (20 points)

You should print the response_code and maybe the headers too.

And did you check the browser console output?

Hello, thank you, you helped me solve part of the problem. Check the browser console output and it was a CORS error. I solved it by adding the lines to the htacces


Header set Access-Control-Allow-Origin "*"

Now with this change, a httprequest request that previously worked fine was broken, it throws me the following error:

Access to fetch at 'url' from origin 'http://localhost:8060' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:8060, *', but only one is allowed. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

1 Answer

0 votes

Hey aljuarismi,

I was wondering... I am having the same issue, but my game is on itch.io

The game I am making is made for a university thesis research. We are simply collecting data from the game itself.

Do you know how I can make an HTTP request from itch to my Google app script?

Do I need to modify the header of my HTTPRequest? And how?

Thanks a lot

by (44 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.