local G=import("\046\047\066\097\115\101\073\110\115\116\097\110\099\101")local c=import("\046\046\047\102\117\110\099\116\105\111\110\115\047\116\121\112\101\111\102")local V=import("\046\046\047\106\115\111\110")local p=G:extend("\072\116\116\112\083\101\114\118\105\099\101")function p.prototype.JSONEncode(c,G)return V.encode(G)end function p.prototype.JSONDecode(c,G)return V.decode(G)end function p.prototype.UrlEncode(c,G)local V=G:gsub("\n","\r\n")return V:gsub("\040\091\094\037\119\093\041",function(G)return string.format("\037\037\037\048\050\088",string.byte(G))end)end function p.prototype.GenerateGUID(V,G)local p=c(G)if G~=nil and p~="\098\111\111\108\101\097\110"then error(("\085\110\097\098\108\101 \116\111 \099\097\115\116 \037\115 \116\111 \098\111\111\108"):format(p),2)end if G==false then return"\048\052\065\069\066\070\069\065-\056\055\070\067-\052\056\048\070-\065\057\056\066-\069\053\069\050\050\049\048\048\055\065\057\048"else return"\123\048\052\065\069\066\070\069\065-\056\055\070\067-\052\056\048\070-\065\057\056\066-\069\053\069\050\050\049\048\048\055\065\057\048\125"end end return p
local BaseInstance = import("./BaseInstance")
local typeof = import("../functions/typeof")
local json = import("../json")

local HttpService = BaseInstance:extend("HttpService")

function HttpService.prototype:JSONEncode(input)
	return json.encode(input)
end

function HttpService.prototype:JSONDecode(input)
	return json.decode(input)
end

function HttpService.prototype:UrlEncode(input)
	local url = input:gsub("\n", "\r\n")

	return url:gsub("([^%w])", function(c)
		return string.format("%%%02X", string.byte(c))
	end)
end

function HttpService.prototype:GenerateGUID(wrapInCurlyBraces)
	local argType = typeof(wrapInCurlyBraces)
	if wrapInCurlyBraces ~= nil and argType ~= "boolean" then
		error(("Unable to cast %s to bool"):format(argType), 2)
	end

	--[[
		`GenerateGUID` allows any value type for `wrapInCurlyBraces`, but it
		only omits the curly braces when `wrapInCurlyBraces` is set to `false`
	]]
	if wrapInCurlyBraces == false then
		return "04AEBFEA-87FC-480F-A98B-E5E221007A90"
	else
		return "{04AEBFEA-87FC-480F-A98B-E5E221007A90}"
	end
end

return HttpService