@@ -83,8 +83,10 @@ local function get_body(bufnr, stop_line, query_line, json_body)
8383 false
8484 )
8585
86- for _ , v in ipairs (json_lines ) do
87- json_string = json_string .. utils .replace_env_vars (v )
86+ for _ , json_line in ipairs (json_lines ) do
87+ if json_line :find (' ^%s+#' ) == nil then
88+ json_string = json_string .. utils .replace_env_vars (json_line )
89+ end
8890 end
8991
9092 json_string = ' {' .. json_string .. ' }'
@@ -145,7 +147,7 @@ local function get_headers(bufnr, query_line)
145147 and header [1 ]:find (' "' ) == nil
146148 -- If header key doesn't contains hashes,
147149 -- so we don't get commented headers
148- and header [1 ]:find (' ^#' ) == nil
150+ and header [1 ]:find (' ^%s+ #' ) == nil
149151 -- If header key doesn't contains HTTP methods,
150152 -- so we don't get the http method/url
151153 and not utils .has_value (http_methods , header [1 ])
@@ -182,7 +184,9 @@ local function get_accept(bufnr, query_line)
182184 )
183185
184186 for _ , accept_data in pairs (accept_line ) do
185- accept = utils .split (accept_data , ' :' )[2 ]
187+ if accept_data :find (' ^%s+#' ) == nil then
188+ accept = utils .split (accept_data , ' :' )[2 ]
189+ end
186190 end
187191 end
188192
@@ -213,10 +217,12 @@ local function get_auth(bufnr, query_line)
213217 )
214218
215219 for _ , auth_data in pairs (auth_line ) do
216- -- Split by spaces, e.g. {'Authorization:', 'user:pass'}
217- auth_data = utils .split (auth_data , ' %s+' )
218- -- {'user', 'pass'}
219- auth = utils .split (utils .replace_env_vars (auth_data [2 ]), ' :' )
220+ if auth_data :find (' ^%s+#' ) == nil then
221+ -- Split by spaces, e.g. {'Authorization:', 'user:pass'}
222+ auth_data = utils .split (auth_data , ' %s+' )
223+ -- {'user', 'pass'}
224+ auth = utils .split (utils .replace_env_vars (auth_data [2 ]), ' :' )
225+ end
220226 end
221227 end
222228
0 commit comments