Skip to content
Open
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
15 changes: 1 addition & 14 deletions lua/plenary/curl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,7 @@ parse.headers = function(t)
if not t then
return
end
local upper = function(str)
return string.gsub(" " .. str, "%W%l", string.upper):sub(2)
end
return util.kv_to_list(
(function()
local normilzed = {}
for k, v in pairs(t) do
normilzed[upper(k:gsub("_", "%-"))] = v
end
return normilzed
end)(),
"-H",
": "
)
return util.kv_to_list(t, "-H", ": ")
end

parse.data_body = function(t)
Expand Down
4 changes: 2 additions & 2 deletions tests/plenary/curl_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe("CURL Wrapper:", function()
local res = curl.post("https://postman-echo.com/post", {
body = vim.fn.json_encode(json),
headers = {
content_type = "application/json",
["content-type"] = "application/json",
},
}).body
eq(json, vim.fn.json_decode(res).json)
Expand All @@ -157,7 +157,7 @@ describe("CURL Wrapper:", function()
local res = curl.post("https://postman-echo.com/post", {
body = body,
headers = {
content_type = "application/json",
["content-type"] = "application/json",
},
dry_run = true,
})
Expand Down