mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 17:17:33 +00:00
edit: hide body if not showable
This commit is contained in:
parent
00880889bf
commit
0cb1caa020
|
@ -24,6 +24,15 @@ local function getAPIURL(endpoint)
|
|||
return url .. endpoint
|
||||
end
|
||||
|
||||
local function showableBody(endpoint)
|
||||
// if start with /streams or /screenshots return false
|
||||
if (string.sub(endpoint, 1, 8) == "/streams" || string.sub(endpoint, 1, 12) == "/screenshots") then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function gmInte.http.requestAPI(params)
|
||||
local body = params.body || ""
|
||||
local bodyLength = string.len(body)
|
||||
|
@ -33,6 +42,7 @@ function gmInte.http.requestAPI(params)
|
|||
local success = params.success || function() end
|
||||
local failed = params.failed || function(error) gmInte.logError(error.error || error) end
|
||||
local version = gmInte.config.version
|
||||
local showableBody = showableBody(params.endpoint)
|
||||
|
||||
local headers = {
|
||||
["Content-Type"] = "application/json",
|
||||
|
@ -45,7 +55,7 @@ function gmInte.http.requestAPI(params)
|
|||
// Log
|
||||
if (gmInte.config.devInstance) then gmInte.log("HTTP Using dev Instance", true) end
|
||||
gmInte.log("HTTP Request: " .. method .. " " .. url, true)
|
||||
gmInte.log("HTTP Body: " .. body, true)
|
||||
gmInte.log("HTTP Body: " .. (showableBody && body || "HIDDEN"), true)
|
||||
|
||||
// Send
|
||||
HTTP({
|
||||
|
|
Loading…
Reference in New Issue
Block a user