@@ -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,44 +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 auth_not_empty = false
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- local end_line = start_line
212- local auth_line = api .nvim_buf_get_lines (
213- bufnr ,
214- start_line - 1 ,
215- end_line ,
216- false
217- )
218-
219- for _ , auth_data in pairs (auth_line ) do
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
226- end
227- end
228-
229- go_to_line (bufnr , query_line )
230- if not auth_not_empty then
231- return nil
232- end
233- return auth
234- end
235-
236197-- curl_cmd runs curl with the passed options, gets or creates a new buffer
237198-- and then the results are printed to the recently obtained/created buffer
238199-- @param opts curl arguments
@@ -343,7 +304,6 @@ local function run(verbose)
343304 body = get_body (bufnr , next_query , last_query_line_number )
344305 end
345306
346- local auth = get_auth (bufnr , last_query_line_number )
347307 local accept = get_accept (bufnr , last_query_line_number )
348308
349309 local success_req , req_err = pcall (curl_cmd , {
@@ -352,7 +312,6 @@ local function run(verbose)
352312 headers = headers ,
353313 accept = accept ,
354314 body = body ,
355- auth = auth ,
356315 dry_run = verbose and verbose or false ,
357316 })
358317
0 commit comments