FrostyCat
Redemption Seeker
Request Master
Bringing out the true potential of http_request() since 2020
Overview
This library for GMS 2.3+ provides a set of extensions for easily encoding, decoding, and sending HTTP requests. The encoding tools support application/x-www-form-urlencoded, multipart/form-data and application/json request formats, using familiar structs and arrays instead of manual string manipulations. The HTTP helper functions also enable sending requests and receiving responses at source, without a separate HTTP asynchronous event.
Downloads / Links
YoYo Marketplace: Link
GitHub: Link 1 (Request Master + JSON Struct) | Link 2 (Request Master only) | Repository | Wiki
Comparison
Post-2020 GML with Request Master:
Pre-2020 stock GML
Feedback Welcome!
If you have any suggestions for new constructors/use cases or bug reports, please open an issue or contribute on GitHub.
Bringing out the true potential of http_request() since 2020
Overview
This library for GMS 2.3+ provides a set of extensions for easily encoding, decoding, and sending HTTP requests. The encoding tools support application/x-www-form-urlencoded, multipart/form-data and application/json request formats, using familiar structs and arrays instead of manual string manipulations. The HTTP helper functions also enable sending requests and receiving responses at source, without a separate HTTP asynchronous event.
Downloads / Links
YoYo Marketplace: Link
GitHub: Link 1 (Request Master + JSON Struct) | Link 2 (Request Master only) | Repository | Wiki
Comparison
Post-2020 GML with Request Master:
GML:
xhr_get("https://api.steampowered.com/ISteamNews/GetNewsForApp/v2/", {
params: { appid: 282800, count: 1 },
done: function(res) {
show_message("Latest news from 100% Orange Juice: " + res.data.appnews.newsitems[0].title);
},
fail: function() {
show_message("Can't fetch headlines from Steam.");
}
});
GML:
xhr_download("http://web.archive.org/web/20060821000040im_/http://gamemaker.nl/images/header.jpg", working_directory + "gmlegacy.jpg", {
done: function(res) {
sprite_index = sprite_add(res.file, 1, false, false, 0, 0);
},
fail: function(res) {
show_message("Failed to download the image!");
}
});
GML:
xhr_oj = http_get("https://api.steampowered.com/ISteamNews/GetNewsForApp/v2/?appid=282800&count=1");
GML:
if (async_load[? "id"] == xhr_oj) {
switch (async_load[? "status"]) {
case 1: break;
case 0:
var data = json_decode(async_load[? "result"]);
var newsTitle = data[? "appnews"];
newsTitle = newsTitle[? "newsitems"];
newsTitle = newsTitle[| 0];
newsTitle = newsTitle[? "title"];
show_message("Latest news from 100% Orange Juice: " + newsTitle);
ds_map_destroy(data);
break;
default:
show_message("Can't fetch headlines from Steam.");
}
}
GML:
xhr_gmlegacy = http_get_file("http://web.archive.org/web/20060821000040im_/http://gamemaker.nl/images/header.jpg", working_directory + "gmlegacy.jpg");
GML:
if (async_load[? "id"] == xhr_gmlegacy) {
switch (async_load[? "status"]) {
case 1: break;
case 0:
sprite_index = sprite_add(async_load[? "result"], 1, false, false, 0, 0);
break;
default:
show_message("Failed to download the image!");
}
}
Feedback Welcome!
If you have any suggestions for new constructors/use cases or bug reports, please open an issue or contribute on GitHub.
Last edited: