PerformHttpRequest - GET Request not working


#1

As suggested by the developers I’m trying to use HttpRequests to save game data.
I use the built in PerformHttpRequest for that, but it seems that any kind of request method does work except for GET. If anybody could confirm this, I would be thankful.

I also found this post about the same problem.

The function just doesn’t execute anything at all when using GET method, or at least the callback doesn’t get called it seems,and there are no exceptions being thrown.
Apparently @kanersps already talked about this, but I don’t see any solution to it.

Thank you guys.


#2

It could be default values (as in https://wiki.fivem.net/wiki/PerformHttpRequest) don’t work.


#3

Thanks for your answer, I just figured out the solution to this.
The only way to make the GET request work is by putting an empty string into the data parameter.

Like this:

PerformHttpRequest("http://google.com", function(err, text, headers)
  print("Does actually work!")
end, 'GET', '')

You can also add the headers as shown in the wiki, but you have to add the empty data string.
I’m sorry for not having tried that before.
Thank you very much.