@@ -141,7 +141,6 @@ local function get_headers(bufnr, query_line)
141141 header = utils .split (header , ' :' )
142142 if
143143 header [1 ]:lower () ~= ' accept'
144- and header [1 ]:lower () ~= ' authorization'
145144 -- If header key doesn't contains double quotes,
146145 -- so we don't get body keys
147146 and header [1 ]:find (' "' ) == nil
@@ -195,48 +194,6 @@ local function get_accept(bufnr, query_line)
195194 return accept
196195end
197196
198- -- get_auth retrieves the HTTP Authorization and returns a lua table with its values
199- -- @param bufnr Buffer number, a.k.a id
200- -- @param query_line Line to set cursor position
201- local function get_auth (bufnr , query_line )
202- local auth = {}
203- local is_auth_empty = true
204- -- Set stop at end of bufer
205- local stop_line = fn .line (' $' )
206-
207- -- Iterate over all buffer lines
208- for _ = 1 , stop_line do
209- -- Case-insensitive search
210- local start_line = fn .search (' \\ cAuthorization:' , ' ' , stop_line )
211- if start_line ~= 0 then
212- is_auth_empty = false
213- end
214-
215- local end_line = start_line
216- local auth_line = api .nvim_buf_get_lines (
217- bufnr ,
218- start_line - 1 ,
219- end_line ,
220- false
221- )
222-
223- for _ , auth_data in pairs (auth_line ) do
224- if auth_data :find (' ^%s+#' ) == nil then
225- -- Split by spaces, e.g. {'Authorization:', 'user:pass'}
226- auth_data = utils .split (auth_data , ' %s+' )
227- -- {'user', 'pass'}
228- auth = utils .split (utils .replace_env_vars (auth_data [2 ]), ' :' )
229- end
230- end
231- end
232-
233- go_to_line (bufnr , query_line )
234- if is_auth_empty then
235- return nil
236- end
237- return auth
238- end
239-
240197-- curl_cmd runs curl with the passed options, gets or creates a new buffer
241198-- and then the results are printed to the recently obtained/created buffer
242199-- @param opts curl arguments
@@ -347,7 +304,6 @@ local function run(verbose)
347304 body = get_body (bufnr , next_query , last_query_line_number )
348305 end
349306
350- local auth = get_auth (bufnr , last_query_line_number )
351307 local accept = get_accept (bufnr , last_query_line_number )
352308
353309 local success_req , req_err = pcall (curl_cmd , {
@@ -356,7 +312,6 @@ local function run(verbose)
356312 headers = headers ,
357313 accept = accept ,
358314 body = body ,
359- auth = auth ,
360315 dry_run = verbose and verbose or false ,
361316 })
362317
0 commit comments