Complete the code to add the API key as a header in the request.
pm.request.headers.add({ key: 'Authorization', value: '[1]' });The API key is usually sent with the header key 'Authorization' and the value starting with 'Api-Key' followed by the key.
Complete the code to set the API key as a query parameter named 'api_key'.
pm.request.url.addQueryParams([{ key: 'api_key', value: '[1]' }]);The value of the query parameter should be the actual API key string, e.g., '12345'.
Fix the error in the code to correctly add the API key in the headers.
pm.request.headers.add({ key: 'X-API-KEY', value: '[1]' });The value should be the actual API key string, not the header name or other tokens.
Fill both blanks to correctly set the API key in the request headers.
pm.request.headers.add({ key: '[1]', value: '[2]' });The header key should be 'X-API-KEY' and the value should be the actual API key string.
Fill all three blanks to create a test script that checks if the API key header is present and correct.
pm.test('API key header is set', () => { pm.expect(pm.request.headers.get('[1]')).to.eql('[2]'); pm.expect(pm.request.headers.has('[3]')).to.be.true; });
The test checks that the header 'X-API-KEY' exists and its value equals the API key '12345'.