Comments (23)
after I set this in the .vimrc
let g:vrc_curl_opts = {
\ '-sS': '',
\ '--connect-timeout': 10,
\ '-i': '',
\ '--max-time': 60,
\ '-k': '',
\}
it works, I'm using vim 8.1
from vim-rest-console.
I saw a closed old issue:
Auto Formatting Response Doesn't Work #47
I tried '-i' knob but it does not work...
I'm trying to test this plugin and see how it can be integrated into my work flow. it seems very interesting one. reading through README to test now...
from vim-rest-console.
Try :help vrc_auto_format_response_patterns
from vim-rest-console.
You can check out vrc_auto_format_response_patterns
option in the help file. It has a good explanation on formatting response. In short, if Content-Type
header is not present, VRC can't do anything; however, if you already know the content type, you can always set it to the option vrc_response_default_content_type
as
let g:vrc_response_default_content_type = 'application/json'
When you try the -i
option, how does the output look like?
from vim-rest-console.
this is my testfile.rest
http://localhost:8095
-i
-u admin:abc
#GET /virtual-network/5e5f3cf7-b1aa-4b91-976e-23350916ccf7
GET /access-control-list/427bd58a-de4a-4599-9bd1-12200a5fad45
http://localhost:8095
-Ss
-u admin:abc
GET /virtual-network/5e5f3cf7-b1aa-4b91-976e-23350916ccf7
I hit enter when cursor is in first block, and got this:
"__REST_response__" [New File]
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_DisplayOutput:
line 63:
E730: using List as a String
Press ENTER or type command to continue
I hit enter, and in output buffer I got this:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/1.1 200 OK
Content-Length: 4526
Etag: "2018-06-01T13:21:45.811389"
Content-Type: application/json
Date: Wed, 06 Jun 2018 04:19:52 GMT
from vim-rest-console.
after removing -i I got the output content in the buffer. but all in one superlong one line...
it looks -i does not work for me.
from vim-rest-console.
Probably the server returns something unexpected. Will have to debug your request. Please follow these steps.
- Still in the rest file, set these options in normal mode
:let g:vrc_show_command = 1
:let g:vrc_debug = 1
- Then execute the first block, just ignore errors. You can check out the command executed in another popup window. You can copy this command and run it in a console. Please include this output here.
- In normal mode,
:mes
. This should show some output, please paste it here as well.
You can remove any sensitive info from your console output and command.
from vim-rest-console.
with the 2 vim vars set, I got the same error, ignored them, then these from output buffer:
* Rebuilt URL to: admin:abc/
* Hostname was NOT found in DNS cache
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Could not resolve host: admin
* Closing connection 0
curl: (6) Could not resolve host: admin
* Hostname was NOT found in DNS cache
* Trying ::1...
* connect to ::1 port 8095 failed: Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8095 (#1)
* Server auth using Basic with user 'admin'
> GET /access-control-list/427bd58a-de4a-4599-9bd1-12200a5fad45 HTTP/1.1
> Authorization: Basic YWRtaW46SnVuaXBlcg==
> User-Agent: curl/7.35.0
> Host: localhost:8095
> Accept: */*
> Content-Type: application/json
>
< HTTP/1.1 200 OK
< Content-Length: 4526
< Etag: "2018-06-01T13:21:45.811389"
< Content-Type: application/json
< Date: Wed, 06 Jun 2018 04:46:51 GMT
<
{ [data not shown]
HTTP/1.1 200 OK
Content-Length: 4526
Etag: "2018-06-01T13:21:45.811389"
Content-Type: application/json
Date: Wed, 06 Jun 2018 04:46:51 GMT
curl commands being executed:
|| curl -u 'admin:abc' -v 'admin:abc' -H 'Content-Type: application/json' -i --get 'http://localhost:
8095/access-control-list/427bd58a-de4a-4599-9bd1-12200a5fad45'
:mes gives:
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_DisplayOutput:
line 63:
E730: using List as a String
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:32)
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_DisplayOutput:
line 63:
E730: using List as a String
"vim-rest-console.txt" [readonly] 664L, 23117C
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_DisplayOutput:
line 63:
E730: using List as a String
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_DisplayOutput:
line 63:
E730: using List as a String
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_DisplayOutput:
line 63:
E730: using List as a String
E121: Undefined variable: s:vrc_auto_format_response_patterns
1 more line; before #10 21:31:18
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_GetCurlCommand..vrc#opt#DictToCurlArgs:
line 2:
E706: Variable type mismatch for: optVal
[Debug] Command: curl -u 'admin:abc' -v 'admin:abc' -H 'Content-Type: application/json' -i --get 'http://localhost:8095/access-control-list/427bd58a-de4a-4599-9bd1-12200a5fad45'
[Debug] cUrl options: {'-u': ['admin:abc'], '-v': '', '-H': ['Content-Type: application/json'], '-i': []}
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_DisplayOutput:
line 63:
E730: using List as a String
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_GetCurlCommand..vrc#opt#DictToCurlArgs:
line 2:
E706: Variable type mismatch for: optVal
[Debug] Command: curl -u 'admin:abc' -v 'admin:abc' -H 'Content-Type: application/json' -i --get 'http://localhost:8095/access-control-list/427bd58a-de4a-4599-9bd1-12200a5fad45'
[Debug] cUrl options: {'-u': ['admin:abc'], '-v': '', '-H': ['Content-Type: application/json'], '-i': []}
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_DisplayOutput:
line 63:
E730: using List as a String
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_GetCurlCommand..vrc#opt#DictToCurlArgs:
line 2:
E706: Variable type mismatch for: optVal
[Debug] Command: curl -u 'admin:abc' -v 'admin:abc' -H 'Content-Type: application/json' -i --get 'http://localhost:8095/access-control-list/427bd58a-de4a-4599-9bd1-12200a5fad45'
[Debug] cUrl options: {'-u': ['admin:abc'], '-v': '', '-H': ['Content-Type: application/json'], '-i': []}
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_DisplayOutput:
line 63:
E730: using List as a String
Press ENTER or type command to continue
looks like the -v xxx caused the problem?
from vim-rest-console.
Hmm it's weird. Did you add -v
somewhere?
from vim-rest-console.
Ah nvm, it's the result of debug. One thing I notice is that the data part ({ [data not shown]
) comes before the header part. And it's also weird that the credentials follow -v
in the command. Normally, -v
should be on its own.
from vim-rest-console.
as long as I remove the '-i' line, it will works, but not formatted...and that is my original question...
from vim-rest-console.
When I don't set anything for VRC in .vimrc
, executing this request
http://localhost:9200
-i
-u hello:world
GET /testindex/_search
gives me this info output
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0100 1209 100 1209 0 0 121k 0 --:--:-- --:--:-- --:--:-- 131k
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 1209
{ [data not shown] }
and this debug info
[Debug] Command: curl -u 'hello:world' -v -H 'Content-Type: application/json' -i --get 'http://localhost:9200/testindex/_search'
[Debug] cUrl options: {'-u': ['hello:world'], '-v': '', '-H': ['Content-Type: application/json'], '-i': []}
The -v
option is on its own.
from vim-rest-console.
I can manually use this below to format manually in the output buffer
:'<,'>!python -mjson.tool
but everytime I trigger new execution, it set "nomodifiable", even after I manually set modifiable.
is this set for a reason? can this setting be removed?
from vim-rest-console.
Error detected while processing function VrcQuery..<SNR>55_RunQuery..<SNR>55_DisplayOutput:
line 63:
E730: using List as a String
what does that E730 indicate?
from vim-rest-console.
Currently there is no way to turn off nomodifiable
. This can be set by introducing a new option.
I think the main issue is that the response header comes after the data part. Can you verify this by running this command in a shell.
curl -u 'admin:abc' -H 'Content-Type: application/json' -i --get 'http://localhost:8095/access-control-list/427bd58a-de4a-4599-9bd1-12200a5fad45'
E730
is Vim internal error indicating that message. For that error, usually it's due to an unexpected output.
from vim-rest-console.
I found another interesting test result...
if I add this in .vimrc only, with same rest file it works:
let g:vrc_show_command = 1
I remove it from .vimrc and re-test, again there is same issue...
and yes, what you gave work in the shell.
$ curl -u 'admin:abc' -H 'Content-Type: application/json' -i --get 'http://localhost:8095/access-control-list/427bd58a-de4a-4599-9bd1-12200a5fad45'
HTTP/1.1 200 OK
Content-Length: 4526
Etag: "2018-06-01T13:21:45.811389"
Content-Type: application/json
Date: Wed, 06 Jun 2018 05:21:10 GMT
{"access-control-list": {"display_name": "MNS-25180-P-BOT1A_dmz_protected_net_1", "uuid": "427bd58a-de4a-4599-9bd1-12200a5fad45", "parent_uuid": "5e5f3cf7-b1aa-4b91-976
k/5e5f3cf7-b1aa-4b91-976e-23350916ccf7", "parent_type": "virtual-network", "perms2": {"owner": "5d70101e0c5f44c690a89690e93da690", "owner_access": 7, "global_access": 0
f": "http://localhost:8095/access-control-list/427bd58a-de4a-4599-9bd1-12200a5fad45", "id_perms": {"enable": true, "description": null, "created": "2018-04-02T18:33:30.
from vim-rest-console.
Hmm it's really weird. The command output looks normal. Maybe you can try reinstalling VRC.
- Save your
rest
file so that you don't have to retype later then quit vim. - Remove any settings from .vimrc regarding VRC.
- Reinstall VRC.
- Open the
rest
file and try the first block.
from vim-rest-console.
I tried exactly the above suggested, still same exact issue.
with this in .vimrc It works fine:
let g:vrc_show_command = 1
now question is, why does the auto format never worked?
from vim-rest-console.
this is probably vim 7.4 issue.
so I changed another machine with same exact ubuntu/vim release, got same result.
:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:32)
Included patches: 1-52
Modified by [email protected]
Compiled by buildd@
Huge version without GUI. Features included (+) or not (-):
+acl +cmdline_info +emacs_tags -hangul_input +menu +mouse_xterm -python3 +syntax +virtualedit -xsmp
+arabic +comments +eval +iconv +mksession +multi_byte +quickfix +tag_binary +visual -xterm_clipboard
+autocmd +conceal +ex_extra +insert_expand +modify_fname +multi_lang +reltime +tag_old_static +visualextra -xterm_save
-balloon_eval +cryptv +extra_search +jumplist +mouse -mzscheme +rightleft -tag_any_white +viminfo -xpm
-browse +cscope +farsi +keymap -mouseshape +netbeans_intg -ruby -tcl +vreplace
++builtin_terms +cursorbind +file_in_path +langmap +mouse_dec +path_extra +scrollbind +terminfo +wildignore
+byte_offset +cursorshape +find_in_path +libcall +mouse_gpm -perl +signs +termresponse +wildmenu
+cindent +dialog_con +float +linebreak -mouse_jsbterm +persistent_undo +smartindent +textobjects +windows
-clientserver +diff +folding +lispindent +mouse_netterm +postscript -sniff +title +writebackup
-clipboard +digraphs -footer +listcmds +mouse_sgr +printer +startuptime -toolbar -X11
+cmdline_compl -dnd +fork() +localmap -mouse_sysmouse +profile +statusline +user_commands -xfontset
+cmdline_hist -ebcdic +gettext -lua +mouse_urxvt +python -sun_workshop +vertsplit -xim
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation:
gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib/python2.7/config-x86_
64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
my minimum rest file to reproduce this:
http://localhost:9100
-i
-u admin:abc
#GET /virtual-network/5e5f3cf7-b1aa-4b91-976e-23350916ccf7
GET /
my minimum vimrc files to reproduce:
set nocp
if empty(glob('~/.vim/autoload/pathogen.vim'))
silent !curl -fLo ~/.vim/autoload/pathogen.vim --create-dirs
\ https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim
endif
execute pathogen#infect()
with vim8.0 and same files I don't see the problem...
from vim-rest-console.
Shoot, it might be backward compatibility issue since I've updated to Vim 8 for a while, I forget about Vim 7.4. I will need this version to reproduce the issue. Are you fine with using Vim 8 or must it be 7.4?
What puzzles me is let g:vrc_show_command = 1
makes it work. Really strange. Let me look at that part more carefully.
With your fresh install of VRC on Vim 7.4 and vrc_show_command = 1
, is the executed command shown like this one (no -v
)?
curl -u 'admin:abc' -H 'Content-Type: application/json' -i --get 'http://localhost:
8095/access-control-list/427bd58a-de4a-4599-9bd1-12200a5fad45'
from vim-rest-console.
I've done some test with Vim 7.4 (on mac) here, #63 (comment), but can't reproduce your issue.
from vim-rest-console.
For me it didn't work, until I figured out that I didn't have python installed.
from vim-rest-console.
after I set this in the
.vimrc
let g:vrc_curl_opts = { \ '-sS': '', \ '--connect-timeout': 10, \ '-i': '', \ '--max-time': 60, \ '-k': '', \}
it works, I'm using vim 8.1
Thanks, it works
from vim-rest-console.
Related Issues (20)
- JSON formatter not working
- Option to Skip Evaluation Curl Command HOT 1
- Allow global variable to pull in data from environment variables HOT 2
- Authenticate with OAuth2 HOT 3
- Allow to run command before request HOT 2
- How do I change it to a horizontally split buffer instead of vertically split? HOT 1
- Can I auto-format output, e.g. prettify JSON responses? HOT 1
- g:vrc_set_default_mapping issue HOT 1
- Automatic format response does not work for ContentType with charset HOT 4
- Variable replace not working HOT 7
- Execute requests asynchronously and support aborting them
- multipart/form-data Requires cUrl Flags HOT 2
- String escaping in windows and Non-Windows shells
- New feature - write response to file HOT 1
- [Feature Request] Warning check before running request
- [Feature Request] Show more information on performed request
- Reformat output response by using json_pp HOT 1
- Request with Bearer token timing out HOT 2
- Highlight response headers
- use value from response in the following request?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-rest-console.