diepm / vim-rest-console

A REST console for Vim.
658 stars 54 forks source link

POST not included as curl verb #25

Closed shanesmith closed 8 years ago

shanesmith commented 8 years ago

The plugin intentionally omits the -X curl flag when the verb is POST, which is causing me issues with a certain POST api that doesn't require data in the body, in which case the curl command from VRC will effectively be a GET.

Easy to patch, but I was first wondering why this was done?

https://github.com/diepm/vim-rest-console/blob/master/ftplugin/rest.vim#L294

diepm commented 8 years ago

I tried to avoid using -X POST (according to curl man page) but forgot that without the request body (--data), curl would treat it as GET.

We have a couple options.

shanesmith commented 8 years ago

Reading the curl man page I don't think you necessarily need to avoid using -X POST, it rather says that you "normally don't need this option" since other options will internally set the verb. In my opinion I don't think explicitly setting -X would be an issue.

Otherwise, if you still don't want to explicitly set it, I think your first option would be a little cleaner.

diepm commented 8 years ago

I think it should be fine to always use -X POST since -X POST --data 'f1=v1' is still a true POST request anyway.

shanesmith commented 8 years ago

Thanks!