1

I'm a beginner org-mode user. Is there a way to remove baseUrl being duplicated in each block like the following one?

#+NAME: request-something
#+HEADER: :var baseUrl="http://localhost:3000"
#+HEADER: :var email="foo@bar.com"
#+BEGIN_SRC http 
POST ${baseUrl}/api/foo
Content-Type: application/json

{
  "email": "${email}",
}
#+END_SRC

I've tried to extract it as

#+NAME: baseUrl
| http://localhost:3000 |

but keep getting "cannot resolve a template to values" ob-http error trying to read it in src block

BinaryButterfly
  • 291
  • 1
  • 13

1 Answers1

4

OK the following solution did the trick:

  1. add
#+PROPERTY: header-args :var baseUrl="http://localhost:3000"
  1. restart org-mode

Ctrlcc in my case while staying on that PROPERTY line

Messages buffer would output the following lines as a result:

>org-mode restarted
>Local setup has been refreshed

Take a look at this related question if you want to know more How to specify default header arguments in orgmode code blocks

BinaryButterfly
  • 291
  • 1
  • 13