dakrone / es-mode

An Emacs major mode for interacting with Elasticsearch
GNU General Public License v3.0
195 stars 34 forks source link

Allow arbitrary request headers, with ob :var syntax #73

Closed jgdavey closed 4 years ago

jgdavey commented 4 years ago

One of my elasticsearch instances requires a "Token" header to be specified for authentication in the request. This PR adds a way to add arbitrary headers to the request in org-mode.

The syntax (and much of the code) borrows from how org-mode already treats multiple values in :var header args.

Usage looks like this:

#+BEGIN_SRC es :headers X-Token=MYTOKEN Accept=application/json
{
  "query": {}
}
#+END_SRC
dakrone commented 4 years ago

Merged, thanks for adding this!