From 29af39ba93a5f56b706991a081480b5738b53eb3 Mon Sep 17 00:00:00 2001 From: Huynh Duc Dung Date: Thu, 23 May 2024 23:30:50 +0800 Subject: [PATCH] fix(history): add early return for missing response headers --- lua/hurl/history.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/hurl/history.lua b/lua/hurl/history.lua index 823e1be..19dbd67 100644 --- a/lua/hurl/history.lua +++ b/lua/hurl/history.lua @@ -5,6 +5,11 @@ local M = {} ---@param response table M.show = function(response) local container = require('hurl.' .. _HURL_GLOBAL_CONFIG.mode) + if not response.headers then + -- Do not show anything if there is no response + return + end + local content_type = response.headers['content-type'] or response.headers['Content-Type'] or response.headers['Content-type']