Karate – Setting global request headers

Ignore callSingle for now and focus on configure headers.

I think you are missing one step – which is to ensure that configure headers has been “applied” before each Scenario. If you are 100% sure that this applies “globally”, just do this in karate-config.js:

karate.configure('headers', { Accept: 'application/json' });

Else you use the Background (in each feature):

* configure headers = { Accept: 'application/json' }

Typically you have more steps that are common, so you have them in a “common” feature file and call that for every test. Refer: https://github.com/intuit/karate#shared-scope

Leave a Comment