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="[email protected]"
#+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

1 Answer 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.