Open prabirshrestha opened 7 years ago
Seems to be now supported in vim8 using webapi#http#stream
. Doesn't work in neovim since it uses vim8 job apis.
function! s:callback(type, req, data) abort
if a:type == 'out'
let a:req['buffer'] = a:req['buffer'] . a:data
elseif a:type == 'exit'
let res = a:req['buffer']
echom res
endif
endfunction
let req = {
\ 'url': 'https://httpbin.org/get',
\ 'method': 'GET',
\ 'buffer': '',
\ }
let req['out_cb'] = function('s:callback', ['out', req])
let req['exit_cb'] = function('s:callback', ['exit', req])
call webapi#http#stream(req)
Any plans to expose http status code as well as headers here?
I'm not familier to neovim. Anyone please send me pull-request.
Would like to support searching packages online for npmjs.org, cdnjs and hopefully integrate with ctrlp when it supports async.