Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/resty/etcd/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ end


function _M.has_value(arr, val)
for index, value in ipairs(arr) do
for key, value in pairs(arr) do
if value == val then
return index
return key
end
end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code style: this 4 space is useless, please remove it.

return false
end

Expand Down
11 changes: 8 additions & 3 deletions lib/resty/etcd/v3.lua
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,11 @@ local function request_chunk(self, method, host, port, path, opts, timeout)
event.kv.value = decode_json(event.kv.value)
end
event.kv.key = decode_base64(event.kv.key)
if event.prev_kv then
event.prev_kv.value = decode_base64(event.prev_kv.value)
event.prev_kv.value = decode_json(event.prev_kv.value)
event.prev_kv.key = decode_base64(event.prev_kv.key)
end
end
end

Expand Down Expand Up @@ -573,7 +578,7 @@ local function watch(self, key, attr)

local prev_kv
if attr.prev_kv then
prev_kv = attr.prev_kv and 'true' or 'false'
prev_kv = attr.prev_kv and true or false
end

local start_revision
Expand All @@ -588,12 +593,12 @@ local function watch(self, key, attr)

local progress_notify
if attr.progress_notify then
progress_notify = attr.progress_notify and 'true' or 'false'
progress_notify = attr.progress_notify and true or false
end

local fragment
if attr.fragment then
fragment = attr.fragment and 'true' or 'false'
fragment = attr.fragment and true or false
end

local filters
Expand Down