Optionally specify a list of headers to be added to the request.
1linkconfiguration:
2link host: swapi.dev
3link scheme: https
4link base_path: /api
5linkspecs:
6link - request:
7link method: get
8link path: /films/1/
9link headers:
10link - name: Accept
11link value: application/json
12link - name: X-CustomHeader
13link value: some-value
14link response:
15link status_code: 200
See also: Example: Suite Using Headers
Dynamic headers can be added by setting headers
as an object to the this.test
context:
1linkconfiguration:
2link scheme: http
3link host: 127.0.0.1
4link port: 3027
5linkspecs:
6link - before_test:
7link run_type: inline
8link inline:
9link function: !!js/function >
10link function() {
11link this.test.headers = { header2: 'header2-value' };
12link }
13link request:
14link path: /echoHeaders
15link method: get
16link headers:
17link - name: header1
18link value: header1-value
19link response:
20link json_data:
21link - path: "$.header2"
22link value: "header2-value"
23link - path: "$.header1"
24link value: "header1-value"
See also: Overview of Hooks