Skip to content

Commit 6905b83

Browse files
docs: add notation for lua scripting
1 parent c6173ec commit 6905b83

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,22 @@ conflicts with any of your existing ones.
234234
235235
See `:h rest-nvim.commands` for more info
236236

237+
### Lua scripting
238+
239+
```http
240+
http://localhost:8000
241+
242+
# @lang=lua
243+
> {%
244+
local json = vim.json.decode(response.body)
245+
json.data = "overwritten"
246+
response.body = vim.json.encode(json)
247+
%}
248+
```
249+
250+
Put `# @lang=lua` comment just above any script elements.
251+
Scripts without `@lang` will be parsed as javascript code to match with [http spec](https://www.jetbrains.com/help/idea/exploring-http-syntax.html#response-handling)
252+
237253
## Extensions
238254

239255
### Telescope Extension

0 commit comments

Comments
 (0)