This step sets a single HTTP request header using an alternative phrasing to the set header ... with value step. The two steps are functionally identical: the header name and value are stored in the same shared map and applied to all subsequent requests. Placeholder tokens in the value are expanded before storage.
Choose this phrasing when you prefer a more natural sentence style, such as I set the header "Accept" to "application/json" or the declarative form the header "Accept" is "application/json". All three subject forms - I set the header, we set the header, and the header ... is - are interchangeable.
Accepted phrasings
Given I set the header "Header-Name" to "value"
Given we set the header "Header-Name" to "value"
Given the header "Header-Name" is "value"
Examples
Given I set the header "Content-Type" to "application/json"
Given I set the header "Authorization" to "Bearer token123"
Given the header "Accept" is "application/json"
Given we set the header "X-Api-Key" to "abcd-1234"
In a real scenario
Scenario: Request XML output from the API
Given the API base URL is "https://api.example.org/v1"
And I set the header "Accept" to "application/xml"
And the header "X-Api-Key" is "key-9876"
When I send a GET request to "/reports/summary"
Then the API response code should be 200