Complete the code to set the HTTP method to POST in a Postman test script.
pm.request.method = '[1]';
The HTTP method is set to POST using pm.request.method.
Complete the code to add a JSON body to the request in a Postman test script.
pm.request.body.raw = JSON.stringify([1]);The body must be a JavaScript object before stringifying. Option C is a valid object literal.
Fix the error in the code to correctly set a header in a Postman test script.
pm.request.headers.add({ key: '[1]', value: 'application/json' });The correct header key for JSON content is Content-Type with a capital C and T and a hyphen.
Fill both blanks to create a test that checks if the response status code is 200 in Postman.
pm.test('Status code is 200', function () { pm.response.to.have.status([1]); pm.expect(pm.response.code).to.be.[2](200); });
The first blank needs the number 200 for the status code. The second blank is the assertion method equal to check equality.
Fill all three blanks to create a test that verifies the response JSON has a key 'success' with value true in Postman.
pm.test('Response has success true', function () { const jsonData = pm.response.json(); pm.expect(jsonData.[1]).to.be.[2]; pm.expect(typeof jsonData.[3]).to.eql('boolean'); });
The key to check is success (used twice). The value should be true boolean.