Skip to content

Commit

Permalink
Merge pull request #66 from holaplex/mpw/credits-plugin-fix-2
Browse files Browse the repository at this point in the history
hotfixv2 for credits plugin--plswork
  • Loading branch information
mpwsh authored May 9, 2023
2 parents 51f22dc + 644cc1f commit 2383ba5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/hub-gateway/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type: application
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)

version: "0.14.1"
version: "0.14.2"

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
7 changes: 4 additions & 3 deletions charts/hub-gateway/plugins/credits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,19 @@ 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)

-- respond the credit balance to the user too
core.request.set_header(ctx, "X-Credit-Balance", data.balance)
core.response.set_header(ctx, "X-Credit-Balance", data.balance)
core.request.set_header(ctx, "X-Credits-Balance", balance)
core.response.set_header("X-Credits-Balance", balance)
end

return _M

0 comments on commit 2383ba5

Please sign in to comment.