Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martinaskestad/vim-restclient
Rest client allows you to send HTTP requests and view the response directly in vim
https://github.com/martinaskestad/vim-restclient
curl http plugin rest vim
Last synced: 23 days ago
JSON representation
Rest client allows you to send HTTP requests and view the response directly in vim
- Host: GitHub
- URL: https://github.com/martinaskestad/vim-restclient
- Owner: MartinAskestad
- License: mit
- Created: 2024-03-16T10:32:13.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-03-16T10:38:10.000Z (10 months ago)
- Last Synced: 2024-12-06T12:07:27.669Z (23 days ago)
- Topics: curl, http, plugin, rest, vim
- Language: Vim Script
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vim-restclient
Rest client allows you to send HTTP requests and view the response directly
in vim.## Getting started
To get started, create a buffer with the `filetype` 'rest'
```vim
:set ft=rest
```
Enter a http-verb and an url for example:
```
GET https://httpbin.org/get?hello=world
```
Then run the command `:SendRequest` and you'll get the response in a new split.
You can also choose to add headers and a body to your request.
```
POST https://httpbin.org/post
Content-Type: application/json{
"message": "Hello, from vim"
}
```
A *rest* buffer can have multiple requests in one file separating them by
using three '#' symbols. The `:SendRequest` command will run whichever request
the cursor is closest to.
```
GET https://httpbin.org/get###
GET https://httpbin.org/get?again=true
###
POST https://httpbin.org/post
Content-Type: application/json{
"message": "Third times the charm"
}
```Variables can be used to easily reuse values between requests.
```
@user_agent = vim-restclientGET https://httpbin.org/get
User-Agent: {{ user_agent }}###
POST https://httpbin.org/post
User-Agent: {{ user_agent }}
Content-Type: application/x-www-form-urlencodedmessage=Hello+from+vim
```A request can med named allowing to share data between requests and responses.
```vim
# @name get_req
GET https://httpbin.org/get?name=vim###
POST https://httpbin.org/post
Content-Type: application/json{
"name": "{{ get_req.response.body.args.name }}"
}
```## Options
Restclient has some options to automatically put the response, the response
headers and the response body into registers to easily paste in other buffers.g:rest_client_header_register A register where all the response headers
will be stored.
```
let g:rest_client_header_register = 'h'
```g:rest_client_body_register A register where the body of the response
will be stored.
```
let g:rest_client_body_register = 'b'
```g:rest_client_response_register A register where the whole combined response
will be stored.
```
let g:rest_client_response_register = 'r'
```