Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local api = { LoadOrder = 0 }
- function api.Build()
- local Request = {}
- function Request.encode(...) local r = {} for i,s in ipairs({...}) do r[#r+1]=textutils.urlEncode(s) end return table.unpack(r) end
- function Request:parseParams(p) local r = {} for k,v in pairs(p) do r[#r+1]=k.."="..self.encode(v) end return table.concat(r,"&") end
- function Request:post(u,p,h) return http.post(u,self:parseParams(p or {}),h) end
- function Request:get(u,p,h) return http.get(u.."?"..self:parseParams(p or {}),h) end
- return Request
- end
- return api
Add Comment
Please, Sign In to add comment