Skip to content

Commit

Permalink
fix: get json content type for custom content types (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggsalas committed Mar 15, 2024
1 parent 1ddcc92 commit 91badd4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lua/rest-nvim/curl/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ local function create_callback(curl_cmd, opts)

local content_type = res.headers[utils.key(res.headers, "content-type")]
if content_type then
content_type = content_type:match("application/([-a-z]+)") or content_type:match("text/(%l+)")
local isJson = content_type:match("application/.+(json)")

if isJson then
content_type = "json"
else
content_type = content_type:match("application/([-a-z]+)") or content_type:match("text/(%l+)")
end
end

if script_str ~= nil then
Expand Down

0 comments on commit 91badd4

Please sign in to comment.