From def60f7e8170de7f6c148f8c909d54fd5cc152a3 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 14:35:24 +0000 Subject: [PATCH 1/7] feat: Updated lua/hurl/main.lua --- lua/hurl/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/hurl/main.lua b/lua/hurl/main.lua index 10bdeb6..155ffbc 100644 --- a/lua/hurl/main.lua +++ b/lua/hurl/main.lua @@ -5,7 +5,7 @@ local http = require('hurl.http_utils') local M = {} local response = {} -local head_state = '' +local response_state = '' local is_running = false -- Looking for vars.env file base on the current file buffer From 05dc3e6806f4fa84de43e3a1ed5444bb42bf8e8b Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 14:36:10 +0000 Subject: [PATCH 2/7] feat: Updated lua/hurl/main.lua --- lua/hurl/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/hurl/main.lua b/lua/hurl/main.lua index 155ffbc..3c7cd14 100644 --- a/lua/hurl/main.lua +++ b/lua/hurl/main.lua @@ -116,7 +116,7 @@ local on_output = function(code, data, event) return end - if head_state == 'body' then + if response_state == 'body' then -- Append the data to the body if we are in the body state utils.log_info('hurl: append data to body' .. vim.inspect(data)) response.body = response.body or '' From 86cde4e7a4e6423f15981aed0cacad996482dc2e Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 14:36:25 +0000 Subject: [PATCH 3/7] feat: Updated lua/hurl/main.lua --- lua/hurl/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/hurl/main.lua b/lua/hurl/main.lua index 3c7cd14..38d3667 100644 --- a/lua/hurl/main.lua +++ b/lua/hurl/main.lua @@ -126,7 +126,7 @@ local on_output = function(code, data, event) -- TODO: The header parser sometime not working properly, e.g: https://google.com local status = tonumber(string.match(data[1], '([%w+]%d+)')) - head_state = 'start' + response_state = 'start' if status then response.status = status response.headers = { status = data[1] } From ab1643d4a5759e876506a46e59c5b14f8d55c2aa Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 14:36:49 +0000 Subject: [PATCH 4/7] feat: Updated lua/hurl/main.lua --- lua/hurl/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/hurl/main.lua b/lua/hurl/main.lua index 38d3667..fea2540 100644 --- a/lua/hurl/main.lua +++ b/lua/hurl/main.lua @@ -136,7 +136,7 @@ local on_output = function(code, data, event) for i = 2, #data do local line = data[i] if line == '' or line == nil then - head_state = 'body' + response_state = 'body' elseif head_state == 'start' then local key, value = string.match(line, '([%w-]+):%s*(.+)') if key and value then From 36cf8b75b71f8d1b389b53f5d709aa6a954226d7 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 14:37:55 +0000 Subject: [PATCH 5/7] feat: Updated lua/hurl/main.lua --- lua/hurl/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/hurl/main.lua b/lua/hurl/main.lua index fea2540..d82f3e6 100644 --- a/lua/hurl/main.lua +++ b/lua/hurl/main.lua @@ -138,7 +138,7 @@ local on_output = function(code, data, event) if line == '' or line == nil then response_state = 'body' elseif head_state == 'start' then - local key, value = string.match(line, '([%w-]+):%s*(.+)') + local key, value = string.match(line, '([%w-]+):%s*(.+)') or line, '' if key and value then response.headers[key] = value response.headers_str = response.headers_str .. line .. '\r\n' From 0143cd7ef13aca6af1b9bf9c158b227ff1e951f7 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 14:38:17 +0000 Subject: [PATCH 6/7] feat: Updated lua/hurl/main.lua --- lua/hurl/main.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/hurl/main.lua b/lua/hurl/main.lua index d82f3e6..2ff4623 100644 --- a/lua/hurl/main.lua +++ b/lua/hurl/main.lua @@ -145,7 +145,8 @@ local on_output = function(code, data, event) end elseif head_state == 'body' then response.body = response.body or '' - response.body = response.body .. line + response.body = response.body .. + line end end response.raw = data From 92f8359fc35cf0655bea59d5f9ea2ec649061719 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 14:38:45 +0000 Subject: [PATCH 7/7] feat: Updated lua/hurl/main.lua --- lua/hurl/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/hurl/main.lua b/lua/hurl/main.lua index 2ff4623..4d00e9f 100644 --- a/lua/hurl/main.lua +++ b/lua/hurl/main.lua @@ -151,7 +151,7 @@ local on_output = function(code, data, event) end response.raw = data - utils.log_info('hurl: response status ' .. response.status) + utils.log_info('hurl: response status ' .. response.status')) utils.log_info('hurl: response headers ' .. vim.inspect(response.headers)) if response.body then utils.log_info('hurl: response body ' .. response.body)