Skip to content

Commit d14a759

Browse files
committed
Web.AsyncHTTP: Added example in document.
1 parent 43f7526 commit d14a759

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

doc/vital/Web/AsyncHTTP.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@ request({url} [, {settings}])
3535
request({method}, {url} [, {settings}])
3636
Send a request to the server.
3737
This function requires one of the clients, "curl" or "wget".
38+
39+
Example: >
40+
let s:AsyncHTTP = vital#{plugin-name}#new().import('Web.AsyncHTTP')
41+
42+
function! s:user_cb(response) abort
43+
echo a:response
44+
" => Dictionary in the same format as Web.HTTP
45+
endfunction
46+
47+
call s:AsyncHTTP.request({
48+
\ 'url': 'https://example.com',
49+
\ 'user_cb': function('s:user_cb'),
50+
\ })
51+
<
3852
{settings} is a |Dictionary| which contains the following items:
3953

4054
"url" Required

0 commit comments

Comments
 (0)