mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
Use msgpack for API (#1176)
This commit is contained in:
parent
4df2d3c5f8
commit
4deda0e155
15 changed files with 177 additions and 102 deletions
|
|
@ -1,5 +1,7 @@
|
|||
local HttpService = game:GetService("HttpService")
|
||||
|
||||
local msgpack = require(script.Parent.Parent.msgpack)
|
||||
|
||||
local stringTemplate = [[
|
||||
Http.Response {
|
||||
code: %d
|
||||
|
|
@ -31,4 +33,8 @@ function Response:json()
|
|||
return HttpService:JSONDecode(self.body)
|
||||
end
|
||||
|
||||
function Response:msgpack()
|
||||
return msgpack.decode(self.body)
|
||||
end
|
||||
|
||||
return Response
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
local HttpService = game:GetService("HttpService")
|
||||
|
||||
local Promise = require(script.Parent.Promise)
|
||||
local Log = require(script.Parent.Log)
|
||||
local msgpack = require(script.Parent.msgpack)
|
||||
local Promise = require(script.Parent.Promise)
|
||||
|
||||
local HttpError = require(script.Error)
|
||||
local HttpResponse = require(script.Response)
|
||||
|
|
@ -68,4 +69,12 @@ function Http.jsonDecode(source)
|
|||
return HttpService:JSONDecode(source)
|
||||
end
|
||||
|
||||
function Http.msgpackEncode(object)
|
||||
return msgpack.encode(object)
|
||||
end
|
||||
|
||||
function Http.msgpackDecode(source)
|
||||
return msgpack.decode(source)
|
||||
end
|
||||
|
||||
return Http
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue