Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curl Progress Meter is Disruptive #71

Open
dvisztempacct opened this issue Jan 29, 2019 · 5 comments
Open

Curl Progress Meter is Disruptive #71

dvisztempacct opened this issue Jan 29, 2019 · 5 comments

Comments

@dvisztempacct
Copy link

I've been running curl from the vim command line for a while now and have not been able to figure out how to get curl to two important things at the same time:

  1. Silence the progress meter
  2. Display server responses on failure response status

It looks like this plugin suffers the same humiliation:

screenshot from 2019-01-29 12-38-57

IMO the progress meter is annoying and irrelevant 99.9% of the time.

Maybe a different http client would work better?

@dvisztempacct
Copy link
Author

Actually, the progress meter goes is written to stderr, so for my use cases, curl could still work, as long as stderr is redirected somewhere (/dev/null)

@dvisztempacct
Copy link
Author

This works for me:

diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim
index 2dea5c6..c0857a4 100644
--- a/ftplugin/rest.vim
+++ b/ftplugin/rest.vim
@@ -738,7 +738,7 @@ function! s:RunQuery(start, end)
     silent !clear
     redraw!

-    call add(outputInfo['outputChunks'], system(curlCmd))
+    call add(outputInfo['outputChunks'], system(curlCmd . ' 2> /dev/null'))
     if shouldShowCommand
       call add(outputInfo['commands'], curlCmd)
     endif

Maybe this could become a configurable behavior :)

@diepm
Copy link
Owner

diepm commented Jan 30, 2019

Have you tried with -s and -S option? /dev/null won't work for Windows users though.

@dvisztempacct
Copy link
Author

@diepm no combination of arguments I could find actually produced the result I wanted, which was to always see the response body even if the HTTP status indicates an error, and no progress output.

I'm not sure what Windows users can do, but maybe this can be put in a check for paltform, or for if the file exists.

@taybart
Copy link

taybart commented Oct 17, 2019

@dvisztempacct try this

" vim-rest-console
let g:vrc_curl_opts = {
  \ '--connect-timeout' : 10,
  \ '-b': '/path/to/cookie',
  \ '-c': '/path/to/cookie',
  \ '-L': '',
  \ '-i': '',
  \ '-s': '',
  \ '--max-time': 60,
  \ '--ipv4': '',
  \ '-k': '',
\}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants