/RBXFetch

Primary LanguageLuaMIT LicenseMIT

RBXFetch

A lightweight wrapper of Roblox's HttpService

Built with roblox-lua-promise

Installation

The installation is quite easy.

Download the RBXFetch.rbxm in the Releases tab - pick whatever version you prefer (currently there is only one) Then, just drag that file over to Roblox into ServerScriptService

Examples

Simple GET request

Make sure Fetch is defined as the RBXFetch module

Fetch.GET("https://api.example.com/")
	:andThen(function(res)
		local resTable = Fetch.toTable(res)
		for i,v in pairs(resTable) do
			print(i, v)
		end
	end)
	:catch(function(err)
		warn(err)	
	end)

Simple POST request

Fetch.POST("https://api.example.com/", { ["some-property"] = "some-value" }, Enum.HttpContentType.ApplicationJson)
	:andThen(function(res)
		local resTable = Fetch.toTable(res)
		for i,v in pairs(resTable) do
			print(i, v)
		end
	end)
	:catch(function(err)
		warn(err)	
	end)