Skip to content

Commit

Permalink
Revert "Revert "Allow PATCH method on jwt credential endpoint""
Browse files Browse the repository at this point in the history
This reverts commit 17b70c1.
  • Loading branch information
subnetmarco committed Nov 18, 2015
1 parent e526551 commit b5330ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions kong/plugins/jwt/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ return {
return helpers.responses.send_HTTP_OK(self.credential)
end,

PATCH = function(self, dao_factory)
crud.patch(self.params, self.credential, dao_factory.jwt_secrets)
end,

DELETE = function(self, dao_factory)
crud.delete(self.credential, dao_factory.jwt_secrets)
end
Expand Down
8 changes: 5 additions & 3 deletions spec/plugins/jwt/api_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ describe("JWT API", function()

describe("PATCH", function()

it("[SUCCESS] should not be supported", function()
local _, status = http_client.patch(BASE_URL..jwt_secret.id, {key = "alice"})
assert.equal(405, status)
it("[SUCCESS] should update a credential", function()
local response, status = http_client.patch(BASE_URL..jwt_secret.id, {key = "alice",secret = "newsecret"})
assert.equal(200, status)
jwt_secret = json.decode(response)
assert.equal("newsecret", jwt_secret.secret)
end)

end)
Expand Down

0 comments on commit b5330ad

Please sign in to comment.