Skip to content

Commit

Permalink
lua lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mpwsh committed May 9, 2023
1 parent 7655e47 commit 644cc1f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions charts/hub-gateway/plugins/credits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
local core = require("apisix.core")
local http = require("resty.http")
local json = require("apisix.core.json")
local type = type

local schema = {
type = "object",
Expand Down Expand Up @@ -107,16 +106,15 @@ function _M.access(conf, ctx)
end

local data, err_json = json.decode(res.body)

if err_json then
return 500, json.encode({ message = err })
end

if not data.balance then
return 500, json.encode({ message = err })
end
-- convert the balance value to a string
local balance = tostring(data.balance)
-- convert the balance value to a string
local balance = tostring(data.balance)

-- respond the credit balance to the user too
core.request.set_header(ctx, "X-Credits-Balance", balance)
Expand Down

0 comments on commit 644cc1f

Please sign in to comment.