-- Two similar requests, however the latter also sends a file
print(http.post("https://httpbin.org/anything", {
data = http.FormData({
hello = "Hello, world";
});
}):json())
print(http.post("https://httpbin.org/anything", {
data = http.FormData({
hello = "Hello, world";
a_random_file = http.File("hello.txt", "Hello, world in a file", "\n");
})
}):json())
Example results from Roblox Studio's Output window. Observe the "form" JSON key returned by httpbin - the "hello" key in the second request which includes a file has a preceding newline character. Oh dear!
Baseplate auto-recovery file was created - C:/Users/Ozzy/Documents/ROBLOX/AutoSaves
[http] 200 OK | POST https://httpbin.org/anything ( 0.1% ratelimit ) - request:204
▼ {
["args"] = {},
["data"] = "",
["files"] = {},
["form"] = ▼ {
["hello"] = "Hello, world"
},
["headers"] = ▶ {...},
["method"] = "POST",
["origin"] = "23.121.92.239",
["url"] = "https://httpbin.org/anything"
} - Script:31
[http] Encoding B64 chunk 1/1 - b64:54
[http] 200 OK | POST https://httpbin.org/anything ( 0.2% ratelimit ) - request:204
▼ {
["args"] = {},
["data"] = "",
["files"] = ▶ {...},
["form"] = ▼ {
["hello"] = "
Hello, world"
},
["headers"] = ▶ {...},
["method"] = "POST",
["origin"] = "23.121.92.239",
["url"] = "https://httpbin.org/anything"
} - Script:37