mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 04:52:26 +00:00
add Post example
This commit is contained in:
27
com/Net/PostExpl.lua
Normal file
27
com/Net/PostExpl.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
local reqAddr
|
||||
local logReq = true
|
||||
local payload
|
||||
|
||||
if not In.Params and In.Params.url or not In.Params.payload then
|
||||
Out.Error = {
|
||||
code = -32602,
|
||||
message = "no url or payload provided"
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
reqAddr = In.Params.url
|
||||
payload = In.Params.payload
|
||||
|
||||
local resp = Net.Http.Post(logReq, reqAddr, "application/json", payload)
|
||||
if resp then
|
||||
Out.Result.answer = {
|
||||
status = resp.status,
|
||||
body = resp.body
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
Out.Result.answer = {
|
||||
status = resp.status
|
||||
}
|
||||
Reference in New Issue
Block a user