Closed mjakl closed 8 years ago
Found a bug - closing for now.
It would be great if we could specify some default values (I'm tired of y&p
, too). I'm thinking of a global section like what you've done. We just need a convenient way to separate the different request bodies.
My plan was to introduce ---
as a placeholder, so a block is either delimited by an URL, or ---
.
The file would look like that then:
GLOBAL BLOCK
---
---
/_cat/something
Accept: anything/at_all
---
/_cat/indices
From an implementation perspective, I wanted to replace the ---
with the lines of the GLOBAL BLOCK
. This PR works that way, but not 100%.
The above example would the be parsed as if it'd look like that:
GLOBAL BLOCK
/_cat/something
Accept: anything/at_all
GLOBAL BLOCK
/_cat/indices
What is the issue you've encountered that doesn't make it work 100%?
To be honest, I do not know - it seemed that the curl request got muddled and reported something about "not supported http protocol". Maybe you could have a look at the code, I'm pretty sure it's just a small oversight... .
I've tried some examples but can't reproduce the scenario you mention. Do you have an example?
Actually I cannot reproduce it anymore. Maybe I've had something really bad in my file and was too unsure about my VimL :)
I plan to make some changes to your PR to extend the global section feature. Specifically,
--
(double-dash) instead of ---
(triple).So, we can have something like this
### Global section.
// Default host.
http://localhost
// Default header settings.
Content-Type: application/json
Accept: */*
--
### Default host and headers.
--
GET /resource
### Default host with local headers.
--
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
// 'Accept' taken from the global section.
POST /form
form-data=value&
form-submit=1
### New host and default headers.
http://localhost:9200
GET /_cat/nodes?v
What do you think?
Great idea! Let me know if I can help out in any way!
I'm eager to see how you approach this :)
It's finally merged and released. Hope we won't encounter any quirky bugs ;) Thanks for your great idea!
Yeah! Just upgrading :)
This PR fixes #15 and defines a new (optional) global section in the rest file.
Like so:
Please note that this is my very first try with VimScript, so check whether there are newbie mistakes. Especially the jumging around in the rest buffer seems strange to me.
Shouldn't all variables within the functions be
local
scoped? The default seems to beglobal
?