Skip to content

Commit

Permalink
feat: Updated lua/hurl/main.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Mar 6, 2024
1 parent 3056835 commit a277791
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lua/hurl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,24 @@ local function run_current_file(opts)
table.insert(opts, vim.fn.expand('%:p'))
execute_hurl_cmd(opts)
end
local content_type = response.headers['content-type']
or response.headers['Content-Type']
or 'unknown'

utils.log_info('Detected content type: ' .. content_type)
if response.headers['content-length'] == '0' then
utils.log_info('hurl: empty response')
utils.notify('hurl: empty response', vim.log.levels.INFO)
end

if utils.is_json_response(content_type) or content_type:lower():find('html') then
local formatted_body = utils.format(response.body, content_type:lower():find('json') and 'json' or 'html')
if formatted_body then
response.body = formatted_body
end
end

local container = require('hurl.' .. _HURL_GLOBAL_CONFIG.mode)

--- Create a temporary file with the lines to run
---@param lines string[]
Expand Down

0 comments on commit a277791

Please sign in to comment.