vim에서 REST-API 테스트

vim에서 REST-API 테스트

2021, Apr 25    

vim 에디터에서 REST-API 테스트를 위한 도구인 “vial-http”를 설치하고 간단한 예재를 실행해본다.

REST API 시험을 위한 확장기능이고 Vundle로 설치 가능하다.

vial-http github 페이지를 참고한다.

vial-http 모듈 설치

“.vimrc” 파일에 Vundle을 설치를 위한 플러그인 설정을 추가하고 “:BundleUpdate”으로 모듈을 설치한다.

...(skip)
Plugin 'baverman/vial-http'
Plugin 'phanviet/vim-monokai-pro'                                                                                  
...(skip)

__init__.py 오류

설치 후 Windows Powershell 환경에서 vim을 실행하려고 하니 아래와 같이 “__init__.py”에서 오류가 생긴다.

Error detected while processing VimEnter Autocommands for "*":
  File "<string>", line 1, in <module>
Press ENTER or type command to continue
Error detected while processing VimEnter Autocommands for "*":
  File "d:\Dropbox\Config\.vim\bundle\vial\vial\__init__.py", line 31, in init
Press ENTER or type command to continue

“__init__.py” 파일을 보니 “/tmp” 디렉토리에 에러로그를 쓰는 부분에서 오류가 나고 있다.

  27 def init():
  28     import logging
  29     root_logger = logging.getLogger()
  30     root_logger.handlers[:] = []
  31     root_logger.addHandler(logging.FileHandler('/tmp/vial-error.log'))
  32     root_logger.addHandler(VimLoggingHandler())

Windows의 디렉토리 설정을 맞추기 위해 아래와 같이 “c:\Temp” 디렉토리를 심볼릭링크를 만들어주니 정상 실행된다.

 New-Item -ItemType SymbolicLink -Path tmp -Target C:\Temp\

    Directory: C:\

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
l----        2021-04-25 오후 10:30                tmp -> C:\Temp\

Examples

examples에 있는 HTTP 헤더를 지정하고 GET 명령어로 헤더를 가져오는 예제를 실행해 보니 아래처럼 결과를 가져와서 가로분할된 창에 결과를 표시한다.

필수 헤더를 설정하고 GET 라인에서 명령어모드로 전환하고 :VialHttp 명령어를 주면 된다.

vial-http examples

참고