Vim-rest-console
A REST console for Vim.
파일 타입 / 확장자
파일을 .rest
확장자로 만든 뒤 Vim 으로 열어 편집하거나,
빈 버퍼에서 :set filetype=rest
명령으로 rest 편집 모드로 들어간다.
버퍼에 요청할 URL을 호스트, 헤더, 메소드와 상대경로, 본문을 한 줄씩 적는다. 헤더와 본문은 생략 가능하다.
문법
A VRC buffer can have one or many REST request blocks.
A "request block" contains a "host," "optional cUrl options," "optional headers," "query," and an "optional request body" (usually used by POST). A block is defined as follows.
# host
http[s]://domain[:port]
[optional cUrl options]
[optional headers]
# query
POST /path/to/resource
[optional request body]
전역 섹션은 두 개의 대시 '--'로 나머지 섹션과 구분되며 기본 호스트, 선택적 기본 cUrl 옵션(버퍼 범위) 및 선택적 기본 헤더를 포함할 수 있습니다. 이러한 값은 항상 각 요청에 포함됩니다.
# Global definitions.
// Default host.
https://domain[:port]/...
// Default (buffer scope) cUrl options.
-L
--connect-timeout 10
// Default headers.
Accept: application/json
X-Header: Custom Data
--
# Request block that uses default values from the global section.
--
GET /some/query
# Request block that specifies its own host and extra headers.
// Local host.
https://example.net:9200
// Local cUrl opts.
-k
--ipv4
// This cUrl option overwrites the one in the global section.
--connect-timeout 30
-b /path/to/cookie
-c /path/to/cookie
// Extra headers.
Xtra-Header: Some Extra.
// This header will overwrite the one in the global section.
X-Header: New Data
POST /service
var1=value
주석
A comment starts with '#' or '//' and must be on its own line. The following is an example of a VRC buffer with multiple request blocks.
Example
http://127.0.0.1:3000
GET /api/users/bakyeono
http://127.0.0.1:3000
POST /api/languages/ansi-common-lisp
http://127.0.0.1:3000
PUT /api/resources/1789
http://127.0.0.1:3000
Accepts: application/text; charset=utf-8
PUT /api/chat
{
"message": "hello"
}
이렇게 적은 후 요청을 원하는 메시지 위에 커서를 두고 <C-j>를 누르면 요청이 전송되고 결과가 임시 버퍼에 출력된다.