Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ use {
'NTBBloodbath/rest.nvim',
requires = { 'nvim-lua/plenary.nvim' },
config = function()
require('rest-nvim').setup({
result_split_horizontal = false,
})
require("rest-nvim").setup({
-- Open request results in a horizontal split
result_split_horizontal = false,
-- Skip SSL verification, useful for unknown certificates
skip_ssl_verification = false,
})
end
}
```
Expand All @@ -66,12 +69,17 @@ use {
By default `rest.nvim` does not have any key mappings so you will not have
conflicts with any of your existing ones.

To run `rest.nvim` you should map the `<Plug>RestNvim` and `<Plug>RestNvimPreview` commands.
To run `rest.nvim` you should map the following commands:
- `<Plug>RestNvim`, run the request under the cursor
- `<Plug>RestNvimPreview`, preview the request cURL command
- `<Plug>RestNvimLast`, re-run the last request

## Settings

* `result_split_horizontal` opens result on a horizontal split (default opens
on vertical)
- `result_split_horizontal` opens result on a horizontal split (default opens
on vertical)
- `skip_ssl_verification` passes the `-k` flag to cURL in order to skip SSL verification,
useful when using unknown certificates

## Usage

Expand Down
10 changes: 10 additions & 0 deletions doc/rest-nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ FEATURES *rest-nvim-features*
===============================================================================
QUICK START *rest-nvim-quick-start*

After installing `rest.nvim` you will need to configure it using a `setup`
function, it looks like this by default:

`require("rest-nvim").setup({`
` -- Open request results in a horizontal split`
` result_split_horizontal = false,`
` -- Skip SSL verification, useful for unknown certificates`
` skip_ssl_verification = false,`
`})`

In this section we will be using `https://reqres.in/` for requests.

Let's say we want to create a new user and send our body as a JSON, so we
Expand Down
1 change: 1 addition & 0 deletions lua/rest-nvim/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local M = {}

local config = {
result_split_horizontal = false,
skip_ssl_verification = false,
}

--- Get a configuration value
Expand Down
3 changes: 2 additions & 1 deletion lua/rest-nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,9 @@ rest.run = function(verbose)
url = parsed_url.url,
headers = headers,
-- accept = accept,
raw = config.skip_ssl_verification and { "-k" } or nil,
body = body, -- the request body (string/filepath/table)
dry_run = verbose and verbose or false,
dry_run = verbose or false,
})

if not success_req then
Expand Down