Created
June 5, 2020 01:10
-
-
Save jpatrickdill/d56ee4d6d5b706d290e906a5898be753 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local url_query = {arg1="val1", arg2="val2"} | |
local post_json = {a=1, b=2, this="is json"} | |
local HttpService = game:GetService("HttpService") | |
local options = { | |
Url = ("https://httpbin.org/post?%s=%s&%s=%s"):format("arg1", url_query.arg1, "arg2", url_query.arg2), | |
Method = "POST", | |
Headers = {["Content-Type"] = "application/json"}, | |
Body = HttpService:JSONEncode(post_json) | |
} | |
local r = HttpService:RequestAsync(options) | |
print(r.Headers["content-type"]) | |
local data = HttpService:JSONEncode(r.Body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local url_query = {arg1="val1", arg2="val2"} | |
local post_json = {a=1, b=2, this="is json"} | |
local http = require(ReplicatedStorage.http) | |
local r = http.post("https://httpbin.org/post", { query=url_query, data=post_json }) | |
print(r.headers["content-type"]) | |
local data = r:json() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment