-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.server.lua
51 lines (48 loc) · 1.03 KB
/
script.server.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
local roxios = require(game.ReplicatedStorage.roxios)
local HttpService = game:GetService("HttpService")
roxios.Request({
Url = "http://httpbin.org/post",
Method = "POST",
Headers = {
["Content-Type"] = "application/json",
},
Body = HttpService:JSONEncode({ hello = "world" }),
})
:andThen(function(parsedResponse)
print(parsedResponse.data)
end)
:catch(function(error)
warn(error)
end)
roxios.Get("http://httpbin.org/get", true)
:andThen(function(parsedResponse)
print(parsedResponse)
end)
:catch(function(error)
warn(error)
end)
roxios.Post(
"https://httpbin.org/post",
HttpService:JSONEncode({ hello = "world" }),
Enum.HttpContentType.ApplicationJson,
false
)
:andThen(function(parsedResponse)
print(parsedResponse.data)
end)
:catch(function(error)
warn(error)
end)
roxios.RbxApiRequest({
Url = "http://setup.roblox.com/version",
Method = "GET",
Headers = {
["Content-Type"] = "application/json",
},
})
:andThen(function(_, response)
print(response)
end)
:catch(function(error)
warn(error)
end)